emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prefer to split along the longest edge


From: Nicolas Desprès
Subject: Re: Prefer to split along the longest edge
Date: Sat, 14 Dec 2024 16:41:30 +0100



On Sat, Dec 14, 2024 at 3:55 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Nicolas Desprès <nicolas.despres@gmail.com>
> Date: Sat, 14 Dec 2024 15:06:40 +0100
> Cc: rudalics@gmx.at, emacs-devel@gnu.org
>
>  > 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.

You can also set it to a large enough value, no?

Yes, with the same result of disabling vertical split.
 

> 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.

Yes.

> 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.

But N columns are not equivalent to N lines.  IOW, if you have a
window that is (N+1)xN, splitting horizontally is not necessarily TRT.

In such a case, both are equally good, I guess. Most generally, Emacs' frames are rectangles rather than squarish.

Note that I added a condition when the width is fewer than 80 columns to preserve the historical behavior of Emacs to split vertically first.

The condition deciding which orientation is tried first could be further tweaked to accommodate the difference between line height and column width. It could be pixel-based, for instance.

My main point is that we can achieve a better default than blindly splitting vertically.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]