Home » Questions » Computers [ Ask a new question ]

How can I change switch-to-buffer-other-window to split vertically instead of horizontally?

How can I change switch-to-buffer-other-window to split vertically instead of horizontally?

I've recently upgraded Emacs from v22 to v23 in Ubuntu Jaunty 9.04. Prior to the upgrade when I issued the switch-to-buffer-other-window command (either via C-x 4 b or M-x switch-to-buffer-other-window) the new window was below the existing window, however after upgrading it started to split the window horizontally, resulting in the two windows side by side.

Asked by: Guest | Views: 236
Total answers/comments: 1
Guest [Entry]

"From the NEWS (C-h n) section:

*** display-buffer' tries to be smarter when splitting windows. The
new option
split-window-preferred-function' lets
you specify your own function to pop
up new windows. Its default value
split-window-sensibly' can split a
window either vertically or
horizontally, whichever seems more
suitable in the current configuration.
You can tune the behavior of
split-window-sensibly by customizing
split-height-threshold' and the new
option `split-width-threshold'. Both
options now take the value nil to
inhibit splitting in one direction.
Setting split-width-threshold to nil
inhibits horizontal splitting and gets
you the behavior of Emacs 22 in this
respect. In any case, display-buffer
may now split the largest window
vertically even when it is not as wide
as the containing frame.

So, the solution is:

(setq split-width-threshold nil)"