This may not be a direct answer to your question, but it can help.
Emacs manages its list of buffers, including choosing which buffer is displayed when you kill it (via kill-buffer
). I did not watch how this is done, but the documentation is "there . " Many people have created custom buffer-stack control magic to change the way emacs does things, maybe some of them are based on Bayesian analysis or something else. You can imagine the possibilities.
I have never looked at how emacs manages its buffers. Instead, I just bind the other-window
and switch-to-buffer
to simple keystrokes (Cx o, Cx b), and I use them very well.
you can create a simple function for what you want: it should destroy all other windows, and then split the window so that the current buffer is displayed in both. Fortunately, emacs has functions that do just that.
(defun cheeso-show-buffer-two-windows () "Close all other windows; then split, and show the current buffer in both windows." (interactive) (delete-other-windows) (split-window-vertically))
Bind this to a keystroke and badda-bing, you're there. This is a vertical split - windows are displayed in a vertical stack. If you want to divide it horizontally (windows side by side), then replace ... well, you know.
Cheeso
source share