Emacs: Auto Save
auto-save-mode, however, it's not what you think.
auto-save-mode periodically saves a copy of your file with the name
#filename#, that is, with the number sign character #.
When you save the file, those #files# are deleted automatically.
In case of crash or electricity outage, when you open a file afterward, emacs will detect those #files# and ask if you want to recover.
But the problem is, even if no crash, in lots of situations (such as sync to server), you'll find those #files# annoying, because they are often symbolic links to non-existent files, and will cause tools like rsync to complain.
Turn Auto Save On/Off
;; Turn auto save off. e.g. periodically make recovery copy file named #filename# (setq auto-save-default nil) ; t for on, nil for off
Real Automatic Save?
You can set emacs to auto save files directly, instead of creating those #filename#.
Put the following in your emacs init:
(setq auto-save-default t) (setq auto-save-visited-file-name t)
However, this does not work well. Emacs still generates those #files#, this time, named like this:
.#xxtemp.201601134145.44920.el -> firstname.lastname@example.org:1452244010
If you have scripts going thru your machine, you get this error:
error: cannot open /home/john/web/.#vocabulary.html No such file or directory
There are probably ways to fix this, with hooks or timer, but i haven't looked into. There are packages that does real auto save that does not use emacs “auto-save-mode” mechanism. There's one called “real-auto-save” Look in MELPA. (I haven't used it.)
thanks to http://irreal.org/blog/?p=4867, Anna Pawlicka (@AnnaPawlicka)
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboard for Emacs
Ask me question on patreon