I have a window layout with three windows and I would like Emacs to remember the buffers even if the buffers don't exist after restart.

Context: I am using Spacemacs for Clojure development. In window #1 I have my sourcecode. In window #2 I have *cider/repl ..., which is my REPL which is only available after starting it. In window #3 I have *cider-test-report* which is my unit test report. Since the buffers in #2 and #3 are temporary, Emacs fills them with *scratch* after restart.

How to get Emacs to open my usual buffers in windows as soon as the buffers are available?

1 Answer 1


You can save the current window configuration (as well as other features of your current Emacs session) using M-x desktop-save.

As node Saving Emacs Sessions of the Emacs manual tells you:

You can also enable automatic saving of the desktop when you exit Emacs, and automatic restoration of the last saved desktop when Emacs starts: use the Customization buffer (*note Easy Customization::) to set desktop-save-mode to t for future sessions, or add this line in your init file (*note Init File::):

 (desktop-save-mode 1)
  • Does not work for me. The REPL and test window open with *scratch* after restart and don't change after I connect the REPL.
    – Witek
    Commented Apr 25, 2020 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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