I'm new to Unix. Whenever I exit the Emacs editor after editing a file say foo.c by pressing CTRL+X+C, I see a new file automatically created called ~foo.c. What is it and why is it automatically created?
Please help me... Thank you!
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
They are backup files, so you can roll back to the previous version of the file if you need to. If they bother you, just clean them up periodically with:
This will clear all the Of course, you can tell Emacs to stop making them if you want, just add this line to your
| ||||
|
feedback
|
|
What you're seeing is a temporary file created when editing the file. The proper way to save and exit in emacs is Ctrl-x Ctrl-c (I don't believe you let go of Ctrl in between the x and c) Please see here for more emacs help. | |||||||
feedback
|
|
You can disable backups, but that's a bad idea for obvious reasons. If you dislike seeing them alongside the current file, you can tell Emacs to store them somewhere else. I use the following in my ~/.emacs.d/init.el file:
| |||
|
feedback
|
|
When you save a file in Emacs, it automatically creates a backup file (what the file looked like before editing) with the “~” prefix. If you don’t want this, see: http://www.rpi.edu/dept/acs/rpinfo/common/Computing/Consulting/Software/Emacs/Hints/backup.html | |||
feedback
|
foo.c~not~foo.c. – slomojo Jan 23 '11 at 23:24