Last Updated: April 12, 2020
·
240
· wnkz

Keep emacs' ~ files versioned in a directory

Using emacs and tired of all those *~ files ? One quick and dirty solution is the classic find . -name \*~ -delete but there is a better way, those files can actually save you hours of work in case something bad happens.

Add this to your ~/.emacs or whatever configuration file you use:

(setq
   backup-by-copying t
   backup-directory-alist '(("." . "~/.saves"))
   delete-old-versions t
   kept-new-versions 6
   kept-old-versions 2
   version-control t)

Now all those ~ files will be kept inside ~/.saves and versioned.

Cheers