In the shell, emacs is my editor of choice. However, it has one default behavior that has gotten in the way more often than it has helped – automatic generation of backup files in the same directory as the original.
Emacs is great for making quick edits to files on the web server. But I don’t want or need all those
*~ files sitting around. The material is all in version control, so I can already revert to any point in history.
I went to the
#emacs IRC channel on Freenode to ask about this, and was prompty handed a canned help message that led right to the solution to my problem:
backup-directory-alist lets you specify a directory where backup files get saved.
A little googling yielded the following nice snippet from Sean B. Palmer which I prompty deployed in my .emacs file. Problem solved. Thanks, everyone!
;; Turn off the annoying default backup behaviour (if (file-directory-p "~/.emacs.d/backup") (setq backup-directory-alist '(("." . "~/.emacs.d/backup"))) (message "Directory does not exist: ~/.emacs.d/backup"))
Andrew commented :
Emacs is great for making quick edits to files on the web server.
Usually people like to complain that Emacs takes forever to start since it’s an “OS,” not a text editor. :)
simeon commented :
Usually people like to complain that Emacs takes forever to start
Yeah back when Emacs stood for “Eight Megs And Constantly Swapping” this was a problem. Not so much nowadays…
m commented :
Try M-x customize-group backup
The first item is “Make Backup Files”. Turn it off.