Variable: split-window-preferred-direction

split-window-preferred-direction is a customizable variable defined in window.el.gz.

Value

longest

Documentation

The first direction tried when Emacs needs to split a window.

This variable controls in which order split-window-sensibly will try to split the window. That order specially matters when both dimensions of the frame are long enough to be split according to split-width-threshold and split-height-threshold. If set to vertical, split-window-sensibly tries to split vertically first and then horizontally. If set to horizontal it does the opposite. If set to longest (the default), the first direction tried depends on the frame shape: in landscape orientation it will be like horizontal, but in portrait it will be like vertical. In other words, the longest of the two dimension is split first.

If both split-width-threshold and split-height-threshold cannot be satisfied, it will fallback to split vertically.

See split-window-preferred-function for more control of the splitting strategy.

This variable was added, or its default value changed, in Emacs 31.1.

View in manual

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defcustom split-window-preferred-direction 'longest
  "The first direction tried when Emacs needs to split a window.
This variable controls in which order `split-window-sensibly' will try
to split the window.  That order specially matters when both dimensions
of the frame are long enough to be split according to
`split-width-threshold' and `split-height-threshold'.
If set to `vertical', `split-window-sensibly' tries to split vertically
first and then horizontally.
If set to `horizontal' it does the opposite.
If set to `longest' (the default), the first direction tried depends on
the frame shape: in landscape orientation it will be like `horizontal',
but in portrait it will be like `vertical'.  In other words, the longest
of the two dimension is split first.

If both `split-width-threshold' and `split-height-threshold' cannot be
satisfied, it will fallback to split vertically.

See `split-window-preferred-function' for more control of the splitting
strategy."
  :type '(radio
          (const :tag "Try to split vertically first"
                 vertical)
          (const :tag "Try to split horizontally first"
                 horizontal)
          (const :tag "Try to split along the longest edge first"
                 longest))
  :version "31.1"
  :group 'windows)