[TxMt] feature request: autosave
Ryan Schmidt
textmate-2004 at ryandesign.com
Tue Jan 18 17:23:12 UTC 2005
It seems nobody has mentioned the autosave implementation that I find
best:
While a document is open and "dirty" the editor saves a copy of the
file periodically in a temporary location (probably in something like
~/Library/ApplicationSupport/AppName/TemporaryFiles). Even after such
an auto-save, the document still appears to the user to be dirty, and
behaves the same way as it would without autosave. When the user asks
to save the file, it actually gets saved to its real location. Clicking
the close box asks if you want to save, as usual. Closing a document
also removes the temporary file.
The point of this is to prevent data loss in the event of application
crash or power loss. The next time the editor opens, it checks its
temporary file directory and opens any that are still there, and they
appear exactly the way they did last time the app was open -- as dirty
windows, and if the user saves them, they go where they originally
were.
I think Mail.app has got a pretty good implementation of this. Of
course it's adapted to emails, not files. In Mail.app it makes sense,
if you're composing an email and quit without saving or sending, that
it auto-saves this mail to the Drafts folder, and the next time you
open Mail.app it auto-opens the mail again. That doesn't make sense in
an editor. But the save-a-copy-to-save-my-ass-if-my-Mac-crashes feature
has merit.
As some others have already said, littering the directory with .bak
files is a bad idea, for the can-be-read-from-a-webserver reason as
well as the wreaks-havoc-on-the-version-control-system reason, not to
mention making it impossible to find the file you need. Creating backup
files with dates in the name is equally bad; if that's what you want,
then you need to read about and use a version control system.
More information about the textmate
mailing list