TransWikia.com

How to save and restore the association of a window to buffer across Emacs sessions?

Emacs Asked by Witek on February 23, 2021

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?

One Answer

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)

Answered by Drew on February 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP