GNU Emacs Manual. Node: Backup Names

prev UPBackup NEXTBackup Deletion

12.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 constructed by appending `~' to the file name being edited; thus, the backup file for `eval.c' would be `eval.c~'.

If you choose to have a series of numbered backup files, backup file names are made by appending `.~', the number, and another `~' to the original file name. Thus, the backup files of `eval.c' would be called `eval.c.~1~', `eval.c.~2~', and so on, through names like `eval.c.~259~' and beyond.

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

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 Do not in any case 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. See 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.

prev UPBackup NEXTBackup Deletion