Monday, August 13, 2007

Backup files in Emacs

This could be useful for novices in Emacs who are yet to hack the Emacs lisp like me. Users of Emacs might be aware of the backup files that are created by emacs when a file is edited.  These backup files are named with ~ following the name. These files could be a nuisance at times. Emacs can be stopped from creating the backup files by adding the following lines in .emacs

(setq make-backup-files nil)

To move the backup files to some other directory the following lines should be added .emacs file.

(setq make-backup-files t)
(make-directory "/tmp/emacsbackup" t)
(setq version-control t)
(setq backup-directory-alist (quote (("." . "/tmp/emacsbackup/"))))

(setq version-control t) will cause different versions of the backup file to be generated. Remove this line if you do not want different version of  file to be generated.

No comments: