GNU bug report logs - #60298
30.0.50; switch-to-buffer-other-window opens new frame when split-window-preferred-function is split-window-vertically

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Sat, 24 Dec 2022 12:51:01 UTC

Severity: normal

Tags: notabug

Found in version 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 60298 <at> debbugs.gnu.org
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 <at> 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.




This bug report was last modified 1 year and 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.