[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

N.3.1.1 Single or Numbered Backups

If you choose to have a single backup file (this is the default), the backup file's name is normally constructed by appending `~' to the file name being edited; thus, the backup file for `eval.c' would be `eval.c~'.

You can change this behavior by defining the variable make-backup-file-name-function to a suitable function. Alternatively you can customize the variable backup-directory-alist to specify that files matching certain patterns should be backed up in specific directories.

A typical use is to add an element ("." . dir) to make all backups in the directory with absolute name dir; Emacs modifies the backup file names to avoid clashes between files with the same names originating in different directories. Alternatively, adding, say, ("." . ".~") would make backups in the invisible subdirectory `.~' of the original file's directory. Emacs creates the directory, if necessary, to make the backup.

If access control stops Emacs from writing backup files under the usual names, it writes the backup file as `%backup%~' in your home directory. Only one such file can exist, so only the most recently made such backup is available.

If you choose to have a series of numbered backup files, backup file names contain `.~', the number, and another `~' after the original file name. Thus, the backup files of `eval.c' would be called `eval.c.~1~', `eval.c.~2~', and so on, all the way through names like `eval.c.~259~' and beyond. The variable backup-directory-alist applies to numbered backups just as usual.

The choice of single backup or numbered backups is controlled by the variable version-control. Its possible values are

t

Make numbered backups.

nil

Make numbered backups for files that have numbered backups already. Otherwise, make single backups.

never

Never make numbered backups; always make single backups.

You can set version-control locally in an individual buffer to control the making of backups for that buffer's file. For example, Rmail mode locally sets version-control to never to make sure that there is only one backup for an Rmail file. @xref{Locals}.

If you set the environment variable VERSION_CONTROL, to tell various GNU utilities what to do with backup files, Emacs also obeys the environment variable by setting the Lisp variable version-control accordingly at startup. If the environment variable's value is `t' or `numbered', then version-control becomes t; if the value is `nil' or `existing', then version-control becomes nil; if it is `never' or `simple', then version-control becomes never.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Roberto on abril, 2 2007 using texi2html 1.76.