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.
The variable version-control determines whether to make single backup files or multiple numbered backup files. Its possible values are:
Make numbered backups for files that have numbered backups already. Otherwise, make single backups. This is the default.
Make numbered backups.
Never make numbered backups; always make single backups.
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 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
nil; if it is ‘never’ or ‘simple’, then
If you set the variable make-backup-file-name-function to a suitable Lisp function, you can override the usual way Emacs constructs backup file names.