As a follow-up to What's the fastest way to reload my .emacs file when I make changes so all my affected buffers will pick up those changes?

It was suggested that the restart question should be asked separately.

Is there an easy way to reopen all the previous buffers and keep the M-p interactive history for commands?


desktop-save-mode handles storing, and restoring, the buffer state of your session. It can also handle window and frames. For persistence of variables across sessions, see savehist-mode. By default it handles the minibuffer history, but it's not limited to it. Another interesting thing that might be interesting to persist is for example the kill-ring.

In short:

(desktop-save-mode 1)
(savehist-mode 1)
(add-to-list 'savehist-additional-variables 'kill-ring) ;; for example
  • 3
    This is true only for Emacs 24.4 or later. – Drew Oct 3 '14 at 2:42
  • @Drew sorry, which part exactly ? – Sigma Oct 3 '14 at 2:52
  • 3
    I was speaking about desktop.el, not savehist. The saving and restoring of windows and frames was added to desktop.el in Emacs 24.4. And support for buffers not associated with files. IOW, pretty much all of it (about desktop). ;-) There is support for buffers associated with files before 24.4, however. – Drew Oct 3 '14 at 3:15
  • Is there any similar solution in Emacs 24.3? I'm using 24.3.1. – b4hand Oct 3 '14 at 22:55
  • No. As I said, it was added in Emacs 24.4. You can pick up the Emacs 24.4 version of libraries desktop.el and frameset.el (which is new in 24.4), and try using them with Emacs 24.3, however. – Drew Oct 17 '14 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.