Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: How can I use a save list to restore buffers from crash?

Tags:

emacs

crash

If you enable the desktop feature, you can return to your previously open set of files when you exit and reenter Emacs. This doesn't seem to be a crash recovery feature however.

If Emacs crashes, there is a save list called "saves-PID-machine" that has a list of the files that had buffers. The list has the full path to both the file itself and the corresponding ~ backup file.

How do I use this save list to get back to the set of visited files in buffers that I had before the crash? None of the files had edits pending so recover-session and recover-file don't do anything.

like image 812
cardiff space man Avatar asked Feb 07 '11 19:02

cardiff space man


1 Answers

You can download and install https://github.com/tripleee/recover-buffers which visits all the files in the auto-save file, and offers to recover any for which unsaved auto-save data exists.

    ;;; recover-buffers.el --- revisit all buffers from an auto-save file
    ;;
    ;;; Commentary:
    ;;
    ;; Works like `recover-session', but attempts to really recover all state
    ;; back to the way it was when Emacs quit or crashed.  Concretely, it
    ;; revisits all buffers which were open, however skipping any which match
    ;; an ignore list.

There is an open Emacs bug about this, too; http://debbugs.gnu.org/889

I am the author of this code, and would appreciate any feedback (though not via this public forum).

like image 166
tripleee Avatar answered Nov 15 '22 09:11

tripleee