(emacs)Backup Copying

Prev: Backup Deletion Up: Backup

Copying vs. Renaming

   Backup files can be made by copying the old file or by renaming it.
This makes a difference when the old file has multiple names.  If the
old file is renamed into the backup file, then the alternate names
become names for the backup file.  If the old file is copied instead,
then the alternate names remain names for the file that you are
editing, and the contents accessed by those names will be the new

   The method of making a backup file may also affect the file's owner
and group.  If copying is used, these do not change.  If renaming is
used, you become the file's owner, and the file's group becomes the
default (different operating systems have different defaults for the

   Having the owner change is usually a good idea, because then the
owner always shows who last edited the file.  Also, the owners of the
backups show who produced those versions.  Occasionally there is a file
whose owner should not change; it is a good idea for such files to
contain local variable lists to set `backup-by-copying-when-mismatch'
locally (Note: File Variables.).

   The choice of renaming or copying is controlled by three variables.
Renaming is the default choice.  If the variable `backup-by-copying' is
non-`nil', copying is used.  Otherwise, if the variable
`backup-by-copying-when-linked' is non-`nil', then copying is used for
files that have multiple names, but renaming may still used when the
file being edited has only one name.  If the variable
`backup-by-copying-when-mismatch' is non-`nil', then copying is used if
renaming would cause the file's owner or group to change.

automatically generated by info2www