changing the auto-save directory in emacs
I’m using git and emacs at the same time and I’ve run into an issue regarding the emacs auto-save options.
When I switch from one git branch to another emacs autosaves the files
I’ve been working on using #<file-name># and the lock-file
using .#<file-name>. These files show up as un-tracked files when
I run git status. They can be added to .gitignore but they will
still clutter up the directory tree.
The solution I landed on is to configure emacs to auto-save these files
in a different directory. I use ~/.emacs.d/auto-save/.
This is the command in init.el:
;; Save auto-save files to ~/.emacs.d/auto-save/
(setq auto-save-file-name-transforms
`((".*" ,concat user-emacs-directory "auto-save/") t))