If Emacs crashes, how can I recover the file I was editing?
By default, Emacs frequently saves the current buffer automatically into a temporary file called:
myfile is the name of the file in the buffer. If you
lose your connection or if Emacs itself crashes, you will probably
be able to get back most of your work. To do so:
- Use Emacs to open the file you were working on when Emacs
crashed. At the bottom of the screen, the following message will
Auto save file is newer; consider M-x recover-file
- This indicates that Emacs has an autosaved file that you can
recover. To recover the file, enter:
- At the bottom of the screen, something like the following will
Recover file: ~/myfile
myfileis the name of the file you are working on.
- Press the
Enterkey. Then Emacs will split the screen. In the bottom screen you will see something like the following:
-rw------- 1 jdoe iago 939 Apr 24 19:44 /home/u1/jdoe/#myfile# -rw------- 1 jdoe iago 551 Apr 24 19:33 /home/u1/jdoe/myfileAt the bottom of the screen will be the following message:
Recover auto save file /home/u1/jdoe/#myfile#? (yes or no)
yes, and Emacs will read in the autosaved file.
Note: If you start Emacs without giving it a filename, you will be working in the temporary "scratch" buffer. In this case, to recover your work, try entering:
Note: If you aren't sure how to enter these commands in Emacs, see In Emacs, how are keystrokes denoted?
At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?
This is document abht in the Knowledge Base.
Last modified on 2009-05-13.
- Fill out this form to submit your issue to the UITS Support Center.
- Please note that you must be affiliated with Indiana University to receive support.
- All fields are required.