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'.
However, when the same logic is implemented by directly modifying
`split-window-sensibly' in window.el, it does not work for one very specific
case: when the frame is 80x30 and C-x 4 f is pressed, the window is not
split and the buffer is opened in another frame. The problem seems to
come from the last eval _expression_ at the bottom of `split-window-sensibly',
but I failed to find a solution. I though better elisp coder than me will find a
solution quickly that's why I am posting here.
Apart from that, I have been using this alternate approach for a couple of
weeks now, and it works well, that's why I am submitting it for inclusion
in Emacs.
I have tested on 8d94a9ec613470b7e8e4ee0e86b643f34f8a724c with emacs built
with --with-imagemagick --with-native-compilation=yes --with-compress-install --with-mailutils --with-gnutls --with-tree-sitter --with-xwidgets --disable-gc-mark-trace --no-create --no-recursion on macOS 15.2.
Best regards,
Nico