Access Keys:
Skip to content (Access Key - 0)

How to recover Emacs Autosave files

Unless you have specified otherwise in your '.emacs' file, Emacs will periodically save the file you are editing into the /var/tmp directory on your workstation.

If

  1. You somehow delete your file.
  2. Your workstation crashes.
  3. You encounter filesystem errors because you are over quota, or because your fileserver has crashed;
    then the auto-save file could be of help. These files are kept for three days before being deleted.

To recover the file, start up emacs with the same filename as you did before, on the SAME WORKSTATION as before. For example, suppose you were editing resume.tex when your workstation crashed. When the workstation becomes usable again, login and do:

	emacs resume.tex &

Note that when you start up Emacs, it will say:

Auto save file is newer; consider M-x recover-file

This is a hint that the file needs to be recovered from the auto-save file. Look at the file you now have in Emacs; if it's blank or it's not the version you wanted, then you need to recover. DO NOT just begin typing, or Emacs will soon make another auto-save file and clobber the old one.

To recover the auto-save file, type:

	M-x recover-file RETURN resume.tex RETURN

Emacs will then show you the date of the auto-save file, just to be sure, and ask you whether you want to recover it. Type 'yes' to recover, or 'no' if you don't want to.

If Emacs says:

Auto save file /var/tmp/#4863. (mit)jruser@resume.tex# not current

then the file does not exist on your workstation (ie: you may have misspelled it).

Now save this file under a different name:
e.g. C-x C-w resume.recover

Emacs will not auto-save this recovered file until you type:

M-x auto-save-mode

This is so you can recover from the old auto-save file again, just in case you change your mind.

Now look at the two files, resume.tex and resume.recover, and take the one you like, or parts of both.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

April 10, 2011

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
e-mac e-mac Delete
emac emac Delete
autosave autosave Delete
recover recover Delete
file file Delete
olc-emacs olc-emacs Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki