If a file’s name is
foo, the names of its numbered backup versions are
foo.~v~, for various integers
v, like this:
foo.~259~, and so on.
user option version-control
This variable controls whether to make a single non-numbered backup file or multiple numbered backups.
Make numbered backups if the visited file already has numbered backups; otherwise, do not. This is the default.
Do not make numbered backups.
Make numbered backups.
The use of numbered backups ultimately leads to a large number of backup versions, which must then be deleted. Emacs can do this automatically or it can ask the user whether to delete them.
user option kept-new-versions
The value of this variable is the number of newest versions to keep when a new numbered backup is made. The newly made backup is included in the count. The default value is 2.
user option kept-old-versions
The value of this variable is the number of oldest versions to keep when a new numbered backup is made. The default value is 2.
If there are backups numbered 1, 2, 3, 5, and 7, and both of these variables have the value 2, then the backups numbered 1 and 2 are kept as old versions and those numbered 5 and 7 are kept as new versions; backup version 3 is excess. The function
find-backup-file-name (see Backup Names) is responsible for determining which backup versions to delete, but does not delete them itself.
user option delete-old-versions
If this variable is
t, then saving a file deletes excess backup versions silently. If it is
nil, that means to ask for confirmation before deleting excess backups. Otherwise, they are not deleted at all.
user option dired-kept-versions
This variable specifies how many of the newest backup versions to keep in the Dired command
dired-clean-directory). That’s the same thing
kept-new-versions specifies when you make a new backup file. The default is 2.