cvfosammmm / Setzer

LaTeX editor written in Python with Gtk
https://www.cvfosammmm.org/setzer/
Other
385 stars 33 forks source link

Auto-save settings and app state (list of opened files) in realtime, instead of on clean exit #373

Open nekohayo opened 9 months ago

nekohayo commented 9 months ago

Testing with v59 (v60 isn't available in Fedora yet), I observed that Setzer apparently saves its state (settings, opened files, etc.) in the pickle format (instead of dconf / gsettings), and apparently does so only when you cleanly quit the application.

Therefore, according to my experience, if you encounter a crash (which unfortunately can happen sometimes), every time you reopen the app after a crash, its settings will be those of the last graceful exit, and it will not remember which files you had open at the time of the crash.

If my guess is correct… then it would be better to write to the pickle file whenever a setting (or the list of opened/closed files) is changed, instead of waiting for graceful shutdown to do it. Even if the app shouldn't crash in theory, in practice it can happen… and so can sudden power outages or the desktop environment crashing!

kinten108101 commented 9 months ago

Testing with v59 (v60 isn't available in Fedora yet), I observed that Setzer apparently saves its state (settings, opened files, etc.) in the pickle format (instead of dconf / gsettings), and apparently does so only when you cleanly quit the application.

Therefore, according to my experience, if you encounter a crash (which unfortunately can happen sometimes), every time you reopen the app after a crash, its settings will be those of the last graceful exit, and it will not remember which files you had open at the time of the crash.

If my guess is correct… then it would be better to write to the pickle file whenever a setting (or the list of opened/closed files) is changed, instead of waiting for graceful shutdown to do it. Even if the app shouldn't crash in theory, in practice it can happen… and so can sudden power outages or the desktop environment crashing!

I thought it's by design that Setzer does not autosave, that's why there's a save button :-) It would be better if Setzer does it like other text editors like vim where all changes are recorded in a temporary file and this temp file is only merged with the original file when click Save.

nekohayo commented 9 months ago

Nah, I'm talking about the way settings & "the list of which files are open" is autosaved, not about autosaving the files' contents.