0

In emacs -Q, I strike C-x 4 b which invoke (switch-to-buffer-other-window) and display the other window vertically as

enter image description here

I reference it's source code

(defun switch-to-buffer-other-window (buffer-or-name &optional norecord)
  (interactive
   (list (read-buffer-to-switch "Switch to buffer in other window: ")))
  (let ((pop-up-windows t))
    (pop-to-buffer buffer-or-name t norecord)))

It apply the procedure of pop-up-window.

How could use "C-x 4 b" pop up the other window which display horizontally instead of vertically?

5
  • 1
    The procedure is pop-to-buffer. pop-up-windows is a variable. Use C-h f and C-h v. – Drew Apr 7 '20 at 4:33
  • I want "C-x 4 b" to display the other window to the right not below. @Drew – AbstProcDo Apr 7 '20 at 5:38
  • That's the default behaviour here (emacs -Q), showing the buffer to the right. – Swedgin Apr 7 '20 at 13:52
  • No, it does not. @Swedgin – AbstProcDo Apr 8 '20 at 3:09
  • @Swedgin Emacs by default chooses where to place the new buffer based on the frame's dimensions. – Arch Stanton Jan 24 at 20:05
1

Try setting the value of split-width-threshold as it works for me when I have wide frames: switching to a buffer in another window splits to the right.

0

Try M-x windmove-display-right RET C-x 4 b.

In general, other than binding windmove-display-* functions, you can evaluate (windmove-display-default-keybindings '(control meta shift)), then you can use C-M-S-arrow key to tell Emacs where to open the next buffer. For instance, C-M-S-right C-x 4 b. I think windmove-display-default-keybindings is available only on Emacs 27 or newer, but AFAIK windmove-display-* may be available in older versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.