xi-editor / xi-mac

The xi-editor mac frontend.
Apache License 2.0
3.02k stars 147 forks source link

autosave triggers #455

Closed nhooyr closed 4 years ago

nhooyr commented 5 years ago

xi-mac should be continuously auto saving files.

nhooyr commented 5 years ago

IE the user shouldn't have to think about saving.

nhooyr commented 5 years ago

Just like Intellij/Xcode etc.

jansol commented 5 years ago

Xcode doesn't autosave...

jansol commented 5 years ago

It does save on exit and on build, yes, but not continuously. Save-on-close could be an option. Building from xi-mac is not possible yet so that part is irrelevant (and would probably be the responsibility of the plugin that deals with building).

nhooyr commented 5 years ago

My bad, I will clarify. I meant save on lost focus which Xcode does do and sublime has an option for as well and jet brains IDE's all do by default.

jansol commented 5 years ago

That sounds like a reasonable option. Can you update the issue title and OP to reflect this? Something like "more save triggers". Maybe add a list of checkboxes for the various save scenarios so we can use this as a tracking issue.

jansol commented 5 years ago

The most difficult part about this would be the config I think? The core does not know about focus and not all frontends will have a concept for it so I'm not sure where the setting would belong. @cmyr thoughts?

jansol commented 5 years ago

A timed autosave (every 5 minutes or whatever, might as well make it configurable) could also be okay. Personally I wouldn't use it in xi-mac, especially once state restoration is fully working, but it is a common feature in other applications and certainly holds value for some people.

nangtrongvuon commented 5 years ago

This doesn't seem too tricky - maybe overriding windowWillResignKey and calling save in XiWindow would work.

cmyr commented 5 years ago

This feels closely related to having state-restoration (https://github.com/xi-editor/xi-editor/issues/913) / autosave implemented in general. I'm not a huge fan of overwriting files on disk until we're asked to explicitly (but maybe having this as an option makes sense) but I agree probably makes sense as a client feature.

nhooyr commented 4 years ago

Going to close as it has been a while and I'm not sure if this is relevant anymore.