unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 17719@debbugs.gnu.org
Subject: 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)	[thread overview]
Message-ID: <b7660c4a-9503-4d4b-890d-818bc5fed287@default> (raw)
In-Reply-To: <<83wqct3jy6.fsf@gnu.org>>

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






       reply	other threads:[~2014-06-06 21:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<0e1661a2-0661-4f9a-a2cf-5bde51ffdb5f@default>
     [not found] ` <<83wqct3jy6.fsf@gnu.org>
2014-06-06 21:32   ` Drew Adams [this message]
2021-07-14 14:40     ` bug#17719: 24.4.50; REGRESSION: `switch-to-buffer-other-frame' does not use other frame Lars Ingebrigtsen
2014-06-06 17:53 Drew Adams
2014-06-06 19:40 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7660c4a-9503-4d4b-890d-818bc5fed287@default \
    --to=drew.adams@oracle.com \
    --cc=17719@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).