most of the text editors are working like that, won't pop up anything if the files are deleted or not created

Autosave is about safety, making sure the document is saved if something goes wrong with Geany, the system, or the file system. So, what this says is when the file is deleted, these other apps won't save, and won't tell the user that they are not doing so? How terribly safe ... not. Especially when the file has disappeared, so the document has no on-disk presence, great, just the time to stop saving and not tell anyone.

Clearly I don't think much of those apps approach 😉

Saving a file is a surprisingly complex process with all the transformations at save, encoding, trailing space removal, multiple ways of actually writing the data to disk, etc. So its not surprising that the plugin uses the Geany document_save() rather than re-creating that functionality, but document_save() is intended for use in an interactive environment, it has several places where it has potential user interaction so its not really the best solution for automatic functionality.

It may be possible to refactor to separate the interactive parts from the actual saving process, but I am not sure without actual analysis that it can be done without creating or increasing race conditions (where something is tested in one place, eg the file exists, and is assumed later to be true, the further those are separated the greater the possibility of something changing externally, eg the file being deleted between test and save).

Anyway if somebody wants to propose something it can be considered.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany-plugins/issues/1199/1246732741@github.com>