Emacs: Save Split Windows Configuration
Undo Split Window (winner-mode)
winner-mode
lets you restore to a previous
Split Windows configuration.
(new in Emacs 23.2 (Released 2010-05))
Example use:
- Alt+x
winner-mode
to turn it on. - Alt+x
split-window-below
. - Alt+x
split-window-right
. - Now, remove all split panes by Alt+x
delete-other-windows
. - Now, you can go back to previous split pane config by Alt+x
winner-undo
【Ctrl+c ←】. There's alsowinner-redo
【Ctrl+c →】.
If you want this functionality always, put this in your Emacs Init File:
;; restore split pane config, winner-undo, winner-redo (winner-mode 1) ;
Save Split Windows Config to Register
You can save windows config to register, like this:
- Alt+x
window-configuration-to-register
【Ctrl+x r w】 (then give it a letter or digit as name). - Alt+x
jump-to-register
【Ctrl+x r j】 to restore a previously saved configuration.
Note: register content is not saved when you quit emacs, even if you have desktop-save-mode
on.
Save Split Window Config Across Sessions
In
Emacs 24.4 (Released 2014-10)
or later, if you restart emacs, previous session's windows and split-panes are automatically restored.
This is because desktop-save-mode
is on by default. 〔see Emacs Init: Restore Opened Files (desktop-save-mode)〕
2012-07-12 Thanks to
Mark Hepburn
https://plus.google.com/b/113859563190964307534/110262280296887306226/about
and
John D Cook
http://www.johndcook.com/blog/2012/03/07/shuffling-emacs-windows/