The auto-save feature in GEdit vs the new GNOME Text Editor

I recently compared GEedit’s auto-save to Kate’s swap-save feature. Both features try to achieve the same goal — to protect your unsaved work from power failures and crashes — but through different means.

The new GNOME 42 release replaces GEdit with GNOME Text Editor (GTE) as the recommended default text editor. GTEd also has a feature like Kate’s swap-save, so I thought I’d revisit the topic.

GEdit has a feature to periodically auto-save your documents (off by default). The option does what it says on the tin: it automatically overwrites your saved document every couple of minutes. You can undo and restore earlier versions until you quit GEdit.

This approach is potentially destructive and can cause you to irrecoverably lose data. It’s a poor implementation mimicking Apple’s TextEdit app on Mac. TextEdit auto-saves your changes, yes, but it also keeps older versions of your documents. You can restore earlier versions of your documents in case you’ve overwritten something you didn’t intend to.

GEdit doesn’t have this, it just overwrites your documents — no questions asked. You can pair it with an external version-tracker tool, but the app doesn’t offer anything.

The new GTEd has a feature that more closely resembles Kate’s swap-recovery system. To recap, Kate store’s a “swap copy” of the unsaved working copy of your files next to the primary copy on your file system. The swap copy is deleted when you save your file, or when you exit Kate and confirm that you want to discard the unsaved changes. If Kate or the system crashes, Kate detects the swap copy and offers you to restore it.

GTEd’s auto-saving feature works more similarly to Kate than GEdit. Kate doesn’t save unsaved files; it only keeps swap copies for changes to files that have been saved at least once. GTEd saves every change in a swap copy, even for unsaved/draft files.

Unlike Kate, it’s stored in the program’s data directory instead of in the same directory as the saved file. GTEd’s approach keeps your directories clean of the hidden “dotfiles” that contain the swap copies. Some may prefer Kate’s approach as it works better with files stored on network shares.

Crucially, when GTEd detects unsaved work, it asks you if want to discard or restore it. However, you may be unclear about what you’re about to restore and what you’ll discard. Kate offers you to compare the two versions (the swap/working copy and the on-disk saved file). GTEd assumes you’re intimately familiar with the two versions; even though you’re not being shown either and have no information to make an informed decision on which to preserve.

Kate doesn’t handle this perfectly either. It differs from an external tool, such as KDIff, to make the comparisons. It should display it internally, so it would be clearer which version is which.

The auto-saving feature is enabled by default in GNOME Text Editor version 41 and newer. You can disable it from the Settings dialog: Behavior: Restore Session. Sort of.

You actually only disable the user interface prompts. Your unsaved documents are still saved to the program’s data directory. You’re not even prompted to restore them even if the app crashed. Since you’re never prompted to decide to discard the drafts, they just keep piling up in the data directory.

GTEd’s auto-save feature has many more bugs. E.g., you can open the same file in multiple windows and make conflicting changes; which makes it random which changes are preserved and which get discarded. Restoring a session with multiple windows with the same file will put you in a state where you can’t close the windows.

Frustratingly, discarded/deleted files and changes may reappear in your next session even if you selected to discard them in the previous session. This isn’t just frustrating but could potentially expose data you wish was never saved to disk. This is kind of out of your control anyway, as you can’t fully disable the behavior.

GNOME Text Editor version 42 reviewed. The projects mentioned here are logged in the project’s bug tracker.