def save(self):
        """Trigger pos handler to save position data."""
        ### the saving mechanism is different if a temporary file
        ### is loaded;
        ###
        ### if it is the case, we delegate the saving to an appropriate
        ### method and exit this one by returning

        if (
            APP_REFS.temp_filepaths_man.is_temp_path(
                APP_REFS.source_path
            )
        ):

            self.save_as()
            return

        ### if all changes are already saved, we notify
        ### the user via the status bar and cancel saving
        ### the file by returning earlier

        if are_changes_saved():

            message = "Didn't save because changes are already saved."

            set_status_message(message)

            return

        ### pass content from source to backup file

        save_timestamped_backup(APP_REFS.source_path, USER_PREFS["NUMBER_OF_BACKUPS"])

        ### save changes on source path
        self.save_data()

        ### store changes from source on the swap file

        APP_REFS.swap_path.write_text(
            APP_REFS.source_path.read_text(encoding="utf-8"), encoding="utf-8"
        )

        ### perform other administrative tasks

        # XXX to be updated and uncommented once
        # the undo/redo feature is implemented

        ## clear undo/redo buffers
        # APP_REFS.ea.clear_buffers()

        ## indicate that changes were saved
        indicate_saved()

        ### notify success via statusbar

        set_status_message("Changes were successfully saved.")
Trigger pos handler to save position data.
nodezator/winman/fileop.py