Open drws opened 3 years ago
There is a setting save_config_on_file_change
to prevent saves when files are opened/closed see https://www.geany.org/manual/current/index.html#id132, but the config will still be saved if you change any setting.
Configuration and sessions are intended to save the state at that point of time so it can be restarted, that is its use-case, and that use-case is not met if something goes wrong if its not saved.
Having a message if the save fails is intended, to let the user know they may lose data (eg due to read-only config), but it does not prevent you editing, it is not a bug.
There have been a number of reports of loss of session due to user action (eg logging out with Geany still running), system action (crashes) and Geany action (plugin crashes) and the only method to handle that is to save when something changes.
There is an in-progress change to split the session files from the config which is being developed on the session_split branch. But I expect it will still save configuration whenever it changes, but the session changes will be in a different file.
You could assist with that branch, or propose your own pull request with your feature, feature requests only happen when "somebody" does them.
All what @elextr said.
@drws, I didn't understand why you want to have read-only project files in the first place. As @elextr said, they are meant to contain session state (if configured) and so need to be writable when the state changes.
@eht16 It's very simple actually, I only wanted to use them as session presets. Although hacky, it was working great until the read-only warning has been introduced in later versions. The warning itself isn't problematic, but the fact that it constantly pops up. A partial solution would be to warn only once per file and suppress subsequent warnings. A more thorough solution would be #2304 (which would also solve #2864). Instead of "write-locking" the file, configurable "session autosaving" would probably be more understandable while having practically the same effect.
I think this is a very uncommon and special use case. I understand your intention but I'm not sure we should and are able to implement each possible use case in Geany. It is already pretty good customizable and extendable but we can't do everything.
Did you try the save_config_on_file_change
as @elextr suggested? This is what changed to previous versions and disabling it will save the session only on quit and when the preferences dialog is closed, as it was before.
Then you should get the previous behaviour.
save_config_on_file_change
does indeed restore previous behaviour and that more or less solves #2864, which is now closed. But there is more that can be done to support use cases we've been discussing while not impairing any of the existing ones - implementing soft write-locking support for example or just respecting the read-only file permission and not complain at all (or at least making that configurable).
Until about a year ago, Geany used to not complain about read-only
.geany
files, which was the only clean way to prevent it from constantly updating the project file. It is doing that without even asking whether to save the session or something along the way (edit: #2864 reported). Now in recent versions (currently using1.37.1
) it basically prevents you from doing work by constantly asking for confirmation that the.geany
file is read-only.Even before the dreadful change was introduced, I submitted a feature request for a program-level session-wise implementation (issue #2304), which is still open. In the meantime the situation has only worsened to what I'm proposing is accepted as a bug.