On Sat, Dec 14, 2024 at 1:34 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Nicolas Desprès <nicolas.despres@gmail.com>
> Date: Sat, 14 Dec 2024 12:45:26 +0100
> Cc: martin rudalics <rudalics@gmx.at>, emacs-devel@gnu.org
>
> On Sat, Dec 14, 2024 at 12:30 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
>  > From: Nicolas Desprès <nicolas.despres@gmail.com>
>  > Date: Sat, 14 Dec 2024 11:05:30 +0100
>  >
[...]
>  >
>  > 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. It works well when implemented in my init.el
>  > and installed by setting `split-window-preferred-function'.
>
>  Why don't the user options split-height-threshold and
>  split-width-threshold we already have are not enough to allow to have
>  this without any code changes?
>
> Because these variables define the minimum size to allow splitting, not the order by which split orientations
> are tried.

Sorry, I don't understand: does it mean you are unable to change the
value of split-height-threshold to cause the function to split
horizontally?  If so, can you show a recipe?

I can by setting split-height-threshold to nil, but then it will never split vertically.

The current implementation first tries to split vertically. If it fails, it tries to split horizontally then it
falls back to vertical splitting.

So to split horizontally, it must first fail to split vertically.

The default threshold values are fine. I just want the default behavior to try the longest edge first.
This way when both splitting would have succeeded (according to their respective threshold value) it will split first where there is more room.

Cheers,
-Nico




--
Nicolas Desprès