Next: Emergency Escape, Previous: Memory Full, Up: Lossage
If Emacs or the computer crashes, you can recover the files you were editing at the time of the crash from their auto-save files. To do this, start Emacs again and type the command M-x recover-session.
This command initially displays a buffer which lists interrupted session files, each with its date. You must choose which session to recover from. Typically the one you want is the most recent one. Move point to the one you choose, and type C-c C-c.
Then recover-session
asks about each of the files that you were
editing during that session; it asks whether to recover that file. If
you answer y for a file, it shows the dates of that file and its
auto-save file, then asks once again whether to recover that file. For
the second question, you must confirm with yes. If you do, Emacs
visits the file but gets the text from the auto-save file.
When recover-session
is done, the files you've chosen to
recover are present in Emacs buffers. You should then save them. Only
this—saving them—updates the files themselves.
As a last resort, if you had buffers with content which were not associated with any files, or if the autosave was not recent enough to have recorded important changes, you can use the etc/emacs-buffer.gdb script with GDB (the GNU Debugger) to retrieve them from a core dump–provided that a core dump was saved, and that the Emacs executable was not stripped of its debugging symbols.
To use this script, run gdb
with the file name of your Emacs
executable and the file name of the core dump, e.g. ‘gdb
/usr/bin/emacs core.emacs’. At the (gdb)
prompt, load the
recovery script: ‘source /usr/src/emacs/etc/emacs-buffer.gdb’.
Then type the command ybuffer-list
to see which buffers are
available. For each buffer, it lists a buffer number. To save a
buffer, use ysave-buffer
; you specify the buffer number, and
the file name to write that buffer into. You should use a file name
which does not already exist; if the file does exist, the script does
not make a backup of its old contents.