![[Home]](https://www.emacswiki.org/images/logo218x38.png)
The layout-restore.el is aimed to save multi-window layout and restore it automatically. ’See also: WindowsAndRegisters.
Let’s suppose you are working in buffer A and the emacs now looks like:
| A | |
| B | C |
(layout 1)
Now for some reason, you want to switch to other buffer and do some other thing, these make your emacs looks like:
| D | E |
(layout 2)
Now you are working in buffer D and want to switch back to buffer A. Usually you can do this simply by ‘C-x b RET’. But what about buffer B and buffer C? They won’t be back automatically when you switch to buffer A. So your emacs looks like below:
| A | E |
Well, I am sure this is NOT what you want.
To start using this package, add following lines to your emacs startup file.
(require 'layout-restore)
(global-set-key [?\C-c ?l] 'layout-save-current)
(global-set-key [?\C-c ?\C-l ?\C-l] 'layout-restore)
(global-set-key [?\C-c ?\C-l ?\C-c] 'layout-delete-current)Change the keybindings to whatever you like.
Now when you are in buffer A of layout 1, press ‘C-c l’ to remember this layout. Then switch to buffer D to your work. Now when you switch back to buffer A, the buffer B and C will be brought back automatically, and be placed exactly as where they were.
If you want, you can also remember layout 2 when you are in buffer D. simply press ‘C-c l’ to remember it, then you can switch between layout 1 and layout 2 easily when you switch between buffer A and D.
To unmemorise a layout, simply press ‘C-c C-l C-c’ in the buffer where you press ‘C-c l’ before.
You are supposed to find the Lisp:layout-restore.el in ElispArea.