Next: , Previous: Documentation for etags, Up: Common requests

5.39 How do I disable backup files?

You probably don't want to do this, since backups are useful, especially when something goes wrong.

To avoid seeing backup files (and other “uninteresting” files) in Dired, load dired-x by adding the following to your .emacs file:

     (add-hook 'dired-load-hook
               (lambda ()
                (require 'dired-x)))

With dired-x loaded, M-o toggles omitting in each dired buffer. You can make omitting the default for new dired buffers by putting the following in your .emacs:

     (add-hook 'dired-mode-hook 'dired-omit-toggle)

If you're tired of seeing backup files whenever you do an ‘ls’ at the Unix shell, try GNU ls with the ‘-B’ option. GNU ls is part of the GNU Fileutils package, available from ‘ftp.gnu.org’ and its mirrors (see Current GNU distributions).

To disable or change the way backups are made, see Backup Names.

Beginning with Emacs 21.1, you can control where Emacs puts backup files by customizing the variable backup-directory-alist. This variable's value specifies that files whose names match specific patters should have their backups put in certain directories. A typical use is to add the element ("." . dir) to force Emacs to put all backup files in the directory dir.