Emacs backup files

Emacs loves to create billions of little ugly-twin backup files all over your hard disk that look like 'myfile~' and 'myfile.txt~'. Here are some better alternatives:

- add the following to your .emacs (this is the best solution)
(setq make-backup-files t)
(setq version-control t)
(setq backup-directory-alist
     (quote ((".*" . "~/backup/emacs_autosave/"))))
; otherwise it keeps asking
(setq kept-new-versions 30)
(setq delete-old-versions t)

[i've forgotten which of these does what, but they're all in my .emacs file...]

make sure to create ~/backup/emacs_autosave first. this will create multiple snapshots of every file you edit and store them in that directory. this avoids having all the blah~ files in your current directory, and is useful if you want to revert to the way you had things 5 minutes ago.

- a quick alias to remove them (courtesy of Randy O'Reilly)
alias cleanup '/bin/rm *~ .*~ #* .#*'

- finally, put Dropbox into 'pack rat' mode, so that it stores every single version of your Dropbox files for eternity.

2 comments:

Anonymous said...

There's an extra parenthesis set in:

(setq backup-directory-alist
(quote((".*" . "path/to/directory"))))

it should be

(setq backup-directory-alist
'((".*" . "path/to/directory)))

Greg said...

Hmmmm. I'm not so sure there is an extra parenthesis.

You've changed the code from:

(quote(blah))

to

'(blah)

Both are legit, aren't they?

Post a Comment