tags:

views:

106

answers:

5

Hello,

I am using emacs 22.2.1 on Ubuntu 9.04.

Every time I open a file and work on it, and then when I list the files in the directory in the terminal I see hashes at the ends of each file.

i.e.

#test.c#
#test.h#

Why is this and how can I remove them?

Many thanks for any advice,

+6  A: 

It's a backup (autosave) file. Emacs should remove them when it finishes editing the file, unless it dies or you kill it without saving the files. It's better not to remove these files since if you do, you cannot recover if Emacs should crash for some reason. When you start Emacs again you can recover the file with M-x recover-this-file to recover it from the backup.

Kinopiko
+1  A: 

These are autosave files.
Have a look at this link to change the files to be in a different directory. Have a look at this

weismat
+1  A: 

Emacs performs a timely backup so you can always have the changes you've made (minus the last 5 minutes of your work) in case of a crash. You can remove it by this command from your working directory rm #*

Penang
Just careful if you have other files beginning with a # there. Rather unlikely, but there you go...
Twisol
If you really don't like these files, you can configure Emacs not to create them or to create them elsewhere. That's much better than executing a dangerous command periodically in your precious directory. Although it would be funny to lose your working files because of autosave and a typo :)
Pascal Cuoq
And there I was thinking I had the cleverest solution and would surely get some upvotes. But these guys are correct. Make sure you don't have any files starting with `#`
Penang
You will probably have to remove the files with this:rm \#*
Jonathan Arkell
+1  A: 

It's a recovery file that emacs creates when you haven't saved your file in a while (but only if it contains unsaved text). As soon as you save your file the recover file is removed. If emacs should crash before you can save, the file can be recovered with M-x recover-file.

Puppe
+2  A: 

You have encountered the feature named "autosave". It saves modified buffers that have not been saved by the user for a while.

I have seen people disable it or change the location of the autosaved buffers to a temporary directory. You can also get more info there, for instance.

Pascal Cuoq