On Sat, Dec 14, 2024 at 7:38 PM Juri Linkov wrote: > > Currently, `split-window-sensibly' prefers to split vertically, > > disregarding the shape of the frame. This is a good default when > > Emacs is taller than wider. However, when Emacs is in fullscreen > > (landscape screen layout), splitting vertically is generally not the > > thing to do because there is plenty of space on the right. > > > > Typical scenario: Emacs is in fullscreen; one buffer is open in a window > > covering the entire frame. Another buffer is opened in a second > > window (C-x 4 f). In this case, the split should generally be horizontal. > > The attached patch changes `split-window-sensibly' to just try > > spliting the longest edge first. > > I see no symmetry between width and height. > > To make a window usable you need to decide how many columns you need > to fit into the window by customizing split-width-threshold. > > By default it's 160 that means two horizontally split windows > with 80 columns in each that allows a comfortable use of each window. > > OTOH, the window height has less relevance since most of the time > all windows are scrolled vertically. > Thanks for your reply. My proposal is not about questioning the relevance of the split-width-threshold and split-height-threshold. They are perfectly fine to me. I don't want to scroll twice more because of a vertical split, whereas I have the 2/3 of my screen free to show another buffer of code. In this scenario both splits would succeed because the frame dimension exceeds by a lot their respective threshold. My point is about the order in which splits are tried. I would like it to first tries the longest edge. So that if it succeed it is likely to be the direction where there is the more space available. But I understand the bias toward vertical splitting, that's why I added a condition to prioritize vertical split if the width is less than 80. This heuristic could be improved, thought.