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, 2020 at 4:33
  • I want "C-x 4 b" to display the other window to the right not below. @Drew
    – Wizard
    Apr 7, 2020 at 5:38
  • That's the default behaviour here (emacs -Q), showing the buffer to the right.
    – Swedgin
    Apr 7, 2020 at 13:52
  • No, it does not. @Swedgin
    – Wizard
    Apr 8, 2020 at 3:09
  • @Swedgin Emacs by default chooses where to place the new buffer based on the frame's dimensions. Jan 24, 2021 at 20:05

2 Answers 2

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 and acknowledge you have read our privacy policy.

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