GNU bug report logs - #17719
24.4.50; REGRESSION: `switch-to-buffer-other-frame' does not use other frame

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Fri, 6 Jun 2014 17:55:01 UTC

Severity: minor

Found in version 24.4.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17719 in the body.
You can then email your comments to 17719 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17719; Package emacs. (Fri, 06 Jun 2014 17:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 06 Jun 2014 17:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4.50; REGRESSION: `switch-to-buffer-other-frame' does not use
 other frame
Date: Fri, 6 Jun 2014 10:53:25 -0700 (PDT)
This regression seems to have been introduced in Emacs 23.  There is no
such problem in Emacs 22.3 and prior.

emacs -Q

Visit some file, say foo.el, alone in the frame.

C-x 2 C-x 3 ; show the buffer in 3 windows

C-x 5 b foo.el ; type the same buffer name, explicitly

One of the other windows on the same frame is selected.

What should happen: the buffer is shown in another frame.



In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
 of 2014-06-01 on ODIEONE
Bzr revision: 117212 michael.albinus <at> gmx.de-20140601104945-g88x0mwrxorz302h
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/snapshot/trunk
 --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
 LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
 -Ic:/Devel/emacs/include''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17719; Package emacs. (Fri, 06 Jun 2014 19:42:01 GMT) Full text and rfc822 format available.

Message #8 received at 17719 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 17719 <at> debbugs.gnu.org
Subject: Re: bug#17719: 24.4.50;
 REGRESSION: `switch-to-buffer-other-frame' does not use other frame
Date: Fri, 06 Jun 2014 22:40:49 +0300
> Date: Fri, 6 Jun 2014 10:53:25 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
> 
> This regression seems to have been introduced in Emacs 23.  There is no
> such problem in Emacs 22.3 and prior.
> 
> emacs -Q
> 
> Visit some file, say foo.el, alone in the frame.
> 
> C-x 2 C-x 3 ; show the buffer in 3 windows
> 
> C-x 5 b foo.el ; type the same buffer name, explicitly
> 
> One of the other windows on the same frame is selected.

That's the intended behavior, AFAIK.  The behavior changed in one of
the last versions (not sure exactly which one, but could very well be
Emacs 23).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17719; Package emacs. (Fri, 06 Jun 2014 21:33:01 GMT) Full text and rfc822 format available.

Message #11 received at 17719 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 17719 <at> debbugs.gnu.org
Subject: RE: bug#17719: 24.4.50;	REGRESSION: `switch-to-buffer-other-frame'
 does not use other frame
Date: Fri, 6 Jun 2014 14:32:20 -0700 (PDT)
> > This regression seems to have been introduced in Emacs 23.  There is no
> > such problem in Emacs 22.3 and prior.
> > emacs -Q
> > Visit some file, say foo.el, alone in the frame.
> > C-x 2 C-x 3 ; show the buffer in 3 windows
> > C-x 5 b foo.el ; type the same buffer name, explicitly
> > One of the other windows on the same frame is selected.
> 
> That's the intended behavior, AFAIK.  The behavior changed in one of
> the last versions (not sure exactly which one, but could very well be
> Emacs 23).

Ah yes.  I remember now.  This is not the first bug report about this.
Mark Kennedy filed a report entitled "switch-to-buffer-other-frame
fails to pop-up window" on Dec 3, 2007 (before we used the bug tracker,
I believe).  I even said then that I liked the new behavior (!).

However, I wonder now if that shouldn't be the behavior just for
`C-x 4 b' with non-nil `pop-up-frames', and not for `C-x 5 b'.
Just a thought.  The doc of `pop-up-frames' used to say that it: 

 looks for an existing window
 already displaying the desired buffer, on any visible frame.  If
 it finds one, it returns that window.  Otherwise it makes a new
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 frame.

(Martin's emphasis, from the cited thread.)  IOW, it was documented
as not necessarily using another frame.  The combination of non-nil
`pop-up-frames' with `switch-to-buffer-other-window' would then not
always impose using a separate frame.  (However, the doc of `p-u-f'
has changed to say now that it always uses a separate frame (for
graphic displays).)

Interactively, a user can use `C-x 5 2' to get the desired new-frame
behavior (but that means s?he needs to know about the exceptional
case and remember another key sequence to cover it).  And if s?he
wants to see similar names of other buffers before choosing, then
s?he needs to use first `C-x 5 b' (or similar) to see the names,
then `C-g', then `C-x 5 2' if the one s?he wants is in fact the
current buffer (e.g., after verifying that what s?he wants is not
some other buffer with a similar name).

Admittedly, those are only minor inconveniences.

In any case, non-interactively things are not so simple.
The circumstance leading to the exceptional behavior is somewhat
complicated:

1. Current buffer is in more than one window of the selected frame.
2. Current buffer is not in any other frame.

If either (1) or (2) is not true then the a new frame is created
and selected for the current buffer.  IOW, this special case means
special-casing one's code, if you want it to switch to an arbitrary
buffer (e.g., a BUFFER arg) in another frame (always).

So regardless of whether we make a change for interactive use,
I wonder if non-interactive (switch-to-buffer-other-frame BUFFER)
shouldn't always create a new frame for BUFFER when it is not
already shown in another frame, even when BUFFER is the current
buffer.

Finally, even if you decide not to change the current behavior,
it should be documented.  Anyone reading the doc will expect that
(switch-to-buffer-other-frame BUFFER) always, not just sometimes,
selects the BUFFER in another frame, and that is not the case.
For the current buffer, it is sometimes the case and sometimes
not the case.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17719; Package emacs. (Wed, 14 Jul 2021 14:41:02 GMT) Full text and rfc822 format available.

Message #14 received at 17719 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 17719 <at> debbugs.gnu.org
Subject: Re: bug#17719: 24.4.50; REGRESSION: `switch-to-buffer-other-frame'
 does not use other frame
Date: Wed, 14 Jul 2021 16:40:43 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

> Finally, even if you decide not to change the current behavior,
> it should be documented.  Anyone reading the doc will expect that
> (switch-to-buffer-other-frame BUFFER) always, not just sometimes,
> selects the BUFFER in another frame, and that is not the case.
> For the current buffer, it is sometimes the case and sometimes
> not the case.

I've now mentioned this in the command's doc string.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 17719 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 14 Jul 2021 14:41:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 12 Aug 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 229 days ago.

Previous Next


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