In Windows at least, when a read-only file is opened and certainly when autosave is on (from numbered bookmarks plugin), get an error message on the screen that cannot be sent away except by using program manager to stop Geany. Is this a problem with the numbered bookmarks plugin, or a broader issue.
Does the problem occur when no plugins are enabled?
If it does not, please move the issue to geany-plugins, otherwise post here.
@andylh the NumberedBookmarks plugin doesn't do any autosave AFAIK. But there is the SaveActions plugin which does and I can see an error dialog popping up telling me my readonly file cannot be saved. This is OK unless that after closing the error dialog, a new one instantly pops up.
Is this what you meant? If so, this is a bug in the SaveActions plugin (which is a core plugin of Geany and so this is the correct project for the issue).
@eht16 you need faster reactions to send the popup away before it times out again, or a longer timeout :)
Seriously though there should be a way of telling autosave which buffers to save (or rather which not to save, having the default to be save).
Readonly files, intentionally deleted files (see #673) etc, there are many times when autosave will try to save when it can't or shouldn't. The user really should have the option to say not to save the buffer.
Yes, I didn't mean to say it's OK like it is. I'm going to try to fix this in any way. The above comment was rather to clear if this also the OP's exact problem.
After having a closer look at the code, it turned out it is not so easy to fix. Either:
1. remember the error in the plugin and disable auto save for this document (i.e. keep a map of all documents and their auto save status) 2. change `document_save_file()` in Geany itself to use info bars instead of dialogs to circumvent the dialog-document-focus-steal circle 3. introduce a variant of the `document_save_file()` function to return `FALSE` as now but additionally a `GError` object to tell the caller about the error but do not any GUI interaction, so the caller can handle error all on its own
I consider only 3. as a serious solution when comparing cost and benefits. Though I personally probably won't work on this.
As a quick'n'dirty workaround we could add some delay in the plugin when the focus-out auto save resulted in an error. This would not solve the problem at all but enables the user to close the file manually or just fix the underlying file save error.
For whoever attempts a PR, it seems to me both 1. and 3. are needed.
Refactoring of `document_save_file()` is needed so a new function, say `document_save_file_error()` without the dialog and with the gerror can be created. Better to create a different function rather than changing the existing function signature which would be a big API break inside Geany and many plugins.
Needs 1. because the plugin still needs to disable saving of that document or the same thing will happen again next timeout. Probably if an error occurs the plugin should show a dialog detailing the error with an option to stop saving the document. And then since it has to keep a list it is only a minor addition to allow users to add files to the list to cure #673.
github-comments@lists.geany.org