I originally had three files: makefile
, readme.txt
, and hashtable.c
in my directory, where I am writing my code in emacs. I noticed that some new files: #hashtable.c#
, #readme.txt#
, hashtable.c~
, and makefile~
have been created. I was wondering what these files were. Are these important, and if not, how do I tell emacs to stop making them? I'm also curious why readme.txt
doesn't get a tilde file and makefile
doesn't get a sharp file.
The file with the ~
is a backup file that automatically gets created when you save a file. The #
readme.txt#
is the file being currently edited/in use (i.e., the autosave version). That will usually go away (unlike the ~
file) when you exit emacs normally (if it crashes or gets killed the # files may stay around).
You might find this page about emacs backup files of interest, and this SO question: How do I control how Emacs makes backup files?
You can prevent backup files from being created with this:
(setq make-backup-files nil)
I recommend installing no-littering
. It automatically puts backup files (file~
) in ~/.emacs.d/var/backup/
. It doesn't do anything about autosaves (#file#
), but there is a note about putting those files in a specified directory in the README:
(setq auto-save-file-name-transforms `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
Neither of these things actually prevents Emacs from creating these files, but I'm assuming most people actually want these files (in case of a crash), but don't want them strewn all over the filesystem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With