[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
23.3.2.2 Single or Numbered Backups
When Emacs makes a single backup file, its 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.