Skip to main content
deleted 10 characters in body; edited tags; edited tags
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257

When emacsEmacs saves a file (save-buffer, write-file etc.), does it overwrite files directly or does it create a temporary file first?

More specifically, if I edit /path-to/file.txt, will emacsEmacs directly open that file and overwrite the contents in-place, or will it write to a temporary file and replace the original file by it after successfully closing the filehandlefile handle?

The latter convention is seen in a lot of other software. If emacsEmacs has this behavior, or can be configured to use it, for my purposes it would be savesafe to disable backup files (M-x customize-variable make-backup-files).

When emacs saves a file (save-buffer, write-file etc.), does it overwrite files directly or does it create a temporary file first?

More specifically, if I edit /path-to/file.txt, will emacs directly open that file and overwrite the contents in-place, or will it write to a temporary file and replace the original file by it after successfully closing the filehandle?

The latter convention is seen in a lot of other software. If emacs has this behavior, or can be configured to use it, for my purposes it would be save to disable backup files (M-x customize-variable make-backup-files).

When Emacs saves a file (save-buffer, write-file etc.), does it overwrite files directly or does it create a temporary file first?

More specifically, if I edit /path-to/file.txt, will Emacs directly open that file and overwrite the contents in-place, or will it write to a temporary file and replace the original file by it after successfully closing the file handle?

The latter convention is seen in a lot of other software. If Emacs has this behavior, or can be configured to use it, for my purposes it would be safe to disable backup files (M-x customize-variable make-backup-files).

Source Link
kdb
  • 1.6k
  • 12
  • 24

How does emacs write files?

When emacs saves a file (save-buffer, write-file etc.), does it overwrite files directly or does it create a temporary file first?

More specifically, if I edit /path-to/file.txt, will emacs directly open that file and overwrite the contents in-place, or will it write to a temporary file and replace the original file by it after successfully closing the filehandle?

The latter convention is seen in a lot of other software. If emacs has this behavior, or can be configured to use it, for my purposes it would be save to disable backup files (M-x customize-variable make-backup-files).