[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60298: 30.0.50; switch-to-buffer-other-window opens new frame when s
From: |
Eli Zaretskii |
Subject: |
bug#60298: 30.0.50; switch-to-buffer-other-window opens new frame when split-window-preferred-function is split-window-vertically |
Date: |
Sat, 24 Dec 2022 15:53:06 +0200 |
tags 60298 notabug
thanks
> From: Jean Louis <bugs@gnu.support>
> Date: Sat, 24 Dec 2022 15:49:37 +0300
>
>
> Function `switch-to-buffer-other-window' opens new frame when variable
> `split-window-preferred-function' is set to `split-window-vertically':
>
> Here is the recipe:
>
> 1. emacs -Q
>
> 2. (setq split-window-preferred-function 'split-window-vertically)
You cannot use split-window-vertically as the value of
split-window-preferred-function. The doc string of
split-window-preferred-function says:
This function is called with a window as single argument and is
supposed to split that window and return the new window.
Whereas the signature of split-window-vertically is:
(split-window-vertically &optional SIZE WINDOW-TO-SPLIT)
So it accepts zero to 2 arguments, but if called with one argument, it
interprets the argument as the size:
If optional argument SIZE is omitted or nil, both windows get the
same height, or close to it. If SIZE is positive, the upper
(selected) window gets SIZE lines. If SIZE is negative, the
lower (new) window gets -SIZE lines.
I see no bug here, just a cockpit error.
If you want to prefer vertical splitting, you should do this with
other variables, as the doc string of split-window-preferred-function
says:
The default is to call the function ‘split-window-sensibly’ which
tries to split the window in a way which seems most suitable.
You can customize the options ‘split-height-threshold’ and/or
‘split-width-threshold’ in order to have ‘split-window-sensibly’
prefer either vertical or horizontal splitting.