Previous: , Up: Auto Save   [Contents][Index]


14.5.3 Recovering Data from Auto-Saves

If you want to use the contents of an auto-save file to recover from a loss of data, use the command M-x recover-file RET file RET. Emacs visits file and then (after your confirmation) restores the contents from the auto-save file #file#. You can then save the file 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
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.

Auto-saving is disabled by M-x recover-file because using this command implies that the auto-save file contains valuable data from a past session. If you save the data in the visited file and then go on to make new changes, turn auto-saving back on with M-x auto-save-mode.