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.

Advertisements

2 thoughts on “Emacs backup files

  1. 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)))

  2. 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?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s