Autosave cannot be disabled

I think this patch should be added to this PR - it's pretty straightforward and fixes a problem introduced here.

all 3 problems are in master branch, you can tell from how config window looks on videos, and PR for Autosave is directed to master (of my fork).
But we can add Autosave fix to this PR no problem

Configured file type is not set to GeanyDocument

Does not affect this PR (it works for untitled documents) and was probably present before - I think you can open it once this PR is merged.

right, it does not affect PUD unless templates start working, then it would in a minor way. But we could just merge changes from that PR into current one or create new one afterwards or just forget about it - as you prefer

File templates are not supported

Alright, maybe I miss something but I think you can determine a non-file-backed documents just by checking if doc->real_path is NULL or not. But if you do, it would be best to "convert" such a document to "persistent" only when it gets modified, otherwise the result may be annoying (e.g., in the LSP plugin I show LSP server initialization handshake result in a new document. Unless modified, such documents can be closed in Geany without any warnings and you don't want to save such temporary documents).

In addition, I don't think you could change the "document-new" signal without affecting existing plugins. Also, plugins would have to be modified to use document_new_file_with_creation_type() consistently and it's kind of error-prone.

In any case, it can wait until this PR is merged.

Here is how i see it:
Initially, Instantsave was working with files, created using template - for half a year, or never worked at all, who knows.
But this exists in code and in documentation:

image.png (view on web)
image.png (view on web)

Then, we have this commit - now filename is pre-generated for template-created document and is set to document struct.
(templates.c, on_new_with_file_template())
image.png (view on web)

So from this point on, Instantsave is not working with such new files.
But - the original intent was for it to work with it as with normal files - instantly create backing file at configured folder, not to do it "after tab recieves changes". Despite this might be annoying.

And this is how it works now in my PR, once we let Instantsave pass beyond if (enable_instantsave && doc->file_name == NULL) again.
This could be fixed directly in master just for Instantsave, but my PR suggest changes that make PUD also work the same way.

If we dont fix this - we should at least remove mentions of supporting templates from geany.txt, in my PR #4077 i kept mentions and furthermore moved it to common part that describes both IS and PUD since their code in that place is common.
Or ofc we could skip all these, again as you prefer.

In addition, I don't think you could change the "document-new" signal without affecting existing plugins.

This is not cool, yes, alternatives would be worse - add field to GeanyDocument or just change template-spawned file name to something definitive like "untitled-tpl" and check for this kind of name here if (enable_instantsave && doc->file_name == NULL)
(as a hack).

Also, plugins would have to be modified to use document_new_file_with_creation_type() consistently and it's kind of error-prone.

Noone is oblidged to use it as old document_new_file() func still exists. If this doesnt brake ABI things should work for any plugin without re-compiling even. But here im not sure

i wont insist on doing anything as i dont personally need any of these to work and dont have that much spare time to keep working on it, but if we want/can complete this work and cut all tails - would be nice.


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/pull/3911/c2504441079@github.com>