开发者

Emacs: How can I use a save list to restore buffers from 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 anyt开发者_如何转开发hing.


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).


Tried M-x recover-session ?

(recover-session)
Recover auto save files from a previous Emacs session. This command first displays a Dired buffer showing you the previous sessions that you could recover from. To choose one, move point to the proper line and then type C-c C-c. Then you'll be asked about a number of files to recover.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜