I would like to customize the behavior when I split windows in Emacs:
I always split because I want to see a separate buffer side by side with the one I'm editing right now.
I use electric-buffer-list(attached to C-x C-b) to navigate buffers.
As a result, I do all of the following separately:
C-x 3 for horizontal separation.
C-x oto go to another window.
C-x C-bto call electric-buffer-list, so I can select the buffer that I want to view.
It looks like I should have written an Elisp function that will do all this when I click C-x 3.
I found this post that describes the part of the focus switch that I want, but I don’t understand how to extend this answer in order to achieve all that I am trying to do.
Edit : after looking at the @lawlist message and debugging my syntax, I think I want to do something like this:
(defun split-right-and-buffer-list ()
(interactive)
(split-window-horizontally)
(other-window 0)
(electric-buffer-list 0))
(global-set-key (kbd "C-x 3") 'split-right-and-buffer-list)
This does everything I want, except that only the current buffer is displayed in the buffer list, and not the usual list of all buffers that I get when I call electric-buffer-listfrom its key binding.
source
share