New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Save Actions] Keep popping up question window of "try to resave the file" after deleting the file #3291
Comments
What happens is that when you enable autosave the timer goes off and that calls But because you have set the save timeout so short by the time you dismiss the dialog the timer has gone off again and calls |
Then I would like to request a new feature which is only autosave the file when the file is created/existing and won't autosave if the file is deleted or not existing. |
Besides, most of the text editors are working like that, which is only autosave the existing files and won't pop up anything if the files are deleted or not created. So it would be more convenient if Geany could have this. |
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 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. |
For safety, there is already a function which is autosave when losing focus. Plus, as far as I know this is the only way to fix a bug which I just opened an issue just now but not sure if someone deleted my issue(issue#1198) or it's GitHub problem. Anyway, another issue from save actions plugin that I opened is even I'm not deleting the files, it will also keep popping up the save file window after I just picked a new template file. |
I transferred the issue to the geany project as Save Actions is a core plugin. |
@zhaolinlau Sorry about the delete, after the transfer it looked like you had accidentally posted the same thing twice, but anyway the templates is the same issue, when there is no file it produces a dialog, just another way of getting to that state. Saving when focus lost is mainly for convenience when the user goes to do something else, saving on a timer is primarily for safety, minimising what may be lost if something goes wrong when typing. The plugin use-case does not require saving delays of 1 sec, 30 secs is plenty (20-30 secs is what things like Google apps use, and they run over the internet). So in the meantime you can set the delay higher as a workaround. As I said above the options are:
And another option might be for the plugin to check the return from But somebody has to do it1 Footnotes |
Alright alright |
Okay, I understand. I just propose my suggestion, because it would be very convenient if it could autosave every second. So we don't need to manually save the file by pressing ctrl+s. And I'm always work on web dev that's why I put the saving delays to only 1 second, because I want to speed up my workflow which is I just need to press alt+tab to switch to the browser and refresh to see the latest result without saving the web dev files. |
Whilst thats a perfectly good use-case, its not the one the autosave plugin was written to address, thats why it is only a partial fit. There used to be a plugin in Geany-plugins, "web-helper", that had a built-in web page preview, but that never got converted to webkitgtk2 and nobody ships webkitgtk1 any more. Webdevs could perhaps resurrect it. Or somebody could write a new plugin that does a simplified save, for example assuming utf-8 and doing none of the other transforms or checks. It could possibly also trigger the browser to save you the reload. |
I see |
I cannot imagine you seriously want to save the current file every second, read every second?! As @elextr said, something like 30 seconds is probably a good compromise, it doesn't trigger that specific bug and more importantly it saves the planet and your money! |
Most of the ides like eclipse, netbeans, microsoft visual studio and text editors like vscodium, notepad++, neovim now do support autosave in 1 second and 1 second is their default timer. So ya I'm serious because it's about convenience. |
OS: Windows 11
Geany Version: 1.38.0
2022-09-14.15-44-12.mp4
The text was updated successfully, but these errors were encountered: