emacsbufferwindow-position

Restore previous window position on buffer switch in Emacs


I split windows to view two different parts of the selected buffer simultaneously. If I switch to another buffer in one of the windows and then switch back to the original buffer, I'll lose the previous window position---I'll see the same parts of the selected buffer in both windows. How can I restore window positions amongst buffer switches?


Solution

  • I think if you use clone-indirect-buffer-other-window(bound to C-x 4 c by default) to obtain the two windows, the window positions will be preserved independently. See Indirect Buffers.