From 75c09b03ed5bd06dd0afd654570236b409341897 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 22 Nov 2025 13:20:05 +0000 Subject: [PATCH] Default split-window-preferred-direction to 'longest' * lisp/window.el (split-window-preferred-direction): Change default value to 'longest'. --- etc/NEWS | 8 ++++---- lisp/window.el | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 7bc247cf47d..ff8ebe7e824 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -392,10 +392,10 @@ for which you can use '(category . tex-shell)'. +++ *** New user option 'split-window-preferred-direction'. Users can now choose in which direction Emacs tries to split first: -vertical or horizontal. With this new setting, when the frame is in -landscape shape for instance, Emacs could split horizontally before -splitting vertically. The default setting preserves Emacs historical -behavior to try to split vertically first. +vertically or horizontally. The new default is to prefer to split +horizontally if the frame is landscape and vertically if it is portrait. +You can customize this option to 'vertical' to restore Emacs's old +behavior of always preferring vertical splits. +++ *** New argument INDIRECT for 'get-buffer-window-list'. diff --git a/lisp/window.el b/lisp/window.el index 702ec1de65d..af5d73d3384 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7532,18 +7532,19 @@ hold: (* 2 (max window-min-height (if mode-line-format 2 1)))))))))) -(defcustom split-window-preferred-direction 'vertical +(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 this is set to -`vertical' (the default), `split-window-sensibly' tries to split -vertically first and then horizontally. If set to `horizontal' it does -the opposite. If set to `longest', 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'. Basically, -the longest of the two dimension is split first. +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.