# how can I programatically transition between those 2 window layouts?

I am trying to implement this window transition

a/             b/
---------      -------------
| 1 | 2 |      |   | 1 | 2 |
---------  ->  | 0 |-------|
| 3 | 4 |      |   | 3 | 4 |
---------      -------------


More precisely, I'm trying to implement something similar to neotree, that opens in some sort of sidebar.

## 1 Answer

With display-buffer-in-side-window you get almost what you are asking for. The windows will not be numbered in the way you want them but the layout is exactly as you requested.

I demonstrate it in the following with the scratch buffer in window 0 of your window-layout:

(display-buffer "*scratch*" '(display-buffer-in-side-window (side . left)))


Note that you can switch between two window configuration with the help of current-window-configuration and set-window-configuration.