[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
23.6.3 Recovering Data from Auto-Saves
You can use the contents of an auto-save file to recover from a loss of data with the command M-x recover-file <RET> file <RET>. This visits file and then (after your confirmation) restores the contents from its auto-save file ‘#file#’. You can then save with C-x C-s to put the recovered text into file itself. For example, to recover file ‘foo.c’ from its auto-save file ‘#foo.c#’, do:
M-x recover-file <RET> foo.c <RET> yes <RET> C-x C-s |
Before asking for confirmation, M-x recover-file displays a directory listing describing the specified file and the auto-save file, so you can compare their sizes and dates. If the auto-save file is older, M-x recover-file does not offer to read it.
If Emacs or the computer crashes, you can recover all the files you were editing from their auto save files with the command M-x recover-session. This first shows you a list of recorded interrupted sessions. Move point to the one you choose, and type C-c C-c.
Then recover-session
asks about each of the files that were
being edited during that session, asking whether to recover that file.
If you answer y, it calls recover-file
, which works in its
normal fashion. It shows the dates of the original file and its
auto-save file, and asks once again whether to recover that 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.
Emacs records information about interrupted sessions for later
recovery in files named
‘~/.emacs.d/auto-save-list/.saves-pid-hostname’. All
of this name except the ‘pid-hostname’ part comes
from the value of auto-save-list-file-prefix
. You can record
sessions in a different place by customizing that variable. If you
set auto-save-list-file-prefix
to nil
in your
‘.emacs’ file, sessions are not recorded for recovery.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |