When Emacs makes a 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~.
If access control stops Emacs from writing backup files under the usual names, it writes the backup file as ~/.emacs.d/%backup%~. Only one such file can exist, so only the most recently made such backup is available.
Emacs can also make numbered backup files. Numbered 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.
version-control determines whether to make
single backup files or multiple numbered backup files. Its possible
The usual way to set this variable is globally, through your init file
or the customization buffer. However, you can set
version-control locally in an individual buffer to control the
making of backups for that buffer's file (see Locals). You can
have Emacs set
version-control locally whenever you visit a
given file (see File Variables). Some modes, such as Rmail mode,
set this variable.
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
accordingly at startup. If the environment variable's value is ‘t’
or ‘numbered’, then
t; if the
value is ‘nil’ or ‘existing’, then
nil; if it is ‘never’ or ‘simple’, then
You can customize the variable
specify that files matching certain patterns should be backed up in
specific directories. This variable applies to both single and
numbered backups. A typical use is to add an element
) 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,
("." . ".~") would make
backups in the invisible subdirectory .~ of the original file's
directory. Emacs creates the directory, if necessary, to make the
If you define the variable
a suitable Lisp function, that overrides the usual way Emacs
constructs backup file names.