unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 745@emacsbugs.donarmstrong.com
Subject: bug#745: pop-to-buffer, frames, and input focus
Date: Wed, 20 Aug 2008 20:42:48 +0200	[thread overview]
Message-ID: <m2tzdfcytz.fsf@gmail.com> (raw)
In-Reply-To: <48AC2F4A.1000507@gmx.at> (martin rudalics's message of "Wed, 20 Aug 2008 16:50:50 +0200")

* martin rudalics [2008-08-20 16:50+0200] writes:

>> Pops up two frames, one frame displays the "foo" buffer and the other
>> the "*scratch*" buffer (so far so good).  But the "foo" frame has not
>> the input focus.  Isn't pop-to-buffer supposed to switch input focus
>> too?
>
>      (select-frame-set-input-focus frame))
>
> gives input focus to the previously selected frame.

Are you saying, that pop-to-buffer can't be used to select the window,
the frame, and input focus at the same time?  If so, when should
pop-to-buffer be used?  Aren't that unusual situations when
pop-to-buffer should not also select the input focus?

If you have any hints or guidelines how be a good buffer/window/frame
citizen in different scenarios, that would be much appreciated.

I'm not using multiple frames myself, but I'm maintaining a package
called SLIME[*] which is used by a number of people who use frames.  I'm
not excited at all about rewriting a dozen or so uses of pop-to-buffer
just to support multiple frames.  There are some variables like
display-buffer-reuse-frames and special-display-buffer-names and I hoped
that those variables were supposed to make it easy to support multiple
frames without cluttering the source code.

[*] http://www.common-lisp.net/project/slime/

>
>> Also note that I had to save and restore the selected frame
>> around display-buffer.  If I try
>>
>>   emacs -Q --eval '(let ((pop-up-frames t))
>>                      (display-buffer (get-buffer-create "foo")))'
>>
>> the "foo" buffer is selected, even though display-buffer should not
>> switch the selected window.
>
> I'm not sure whether on some system there were problems when raising a
> frame and/or giving it input focus, and not selecting it.  At least with
> Emacs 22 the frame was selected already.  Since there's only one window
> on the new frame, that window must be selected as well.
>
> In any case you're right: either the window must not be selected or the
> documentation should tell when and why it selects the window.

The docstring of display-buffer reads
"Make buffer BUFFER-OR-NAME appear in some window but don't select it. ..."
I think it be would less surprising if the input focus would not be switched
to the new frame.

>> Not even save-window-excursion stops display-buffer from switching the
>> frame:
>>
>>   emacs -Q --eval '(save-window-excursion
>>                      (let ((pop-up-frames t))
>>                         (display-buffer (get-buffer-create "foo"))))'
>
> `save-window-excursion' is of no use here: It permits you to change the
> contents of a frame in the body and restore the initial contents
> afterwards.  You do that with the originally selected frame here.  The
> new frame created by `display-buffer' is not affected by this.

save-window-excursion is supposed to "... Also restore the choice of
selected window. ..."

If I do

   emacs -Q -nw --eval '(save-window-excursion
                          (let ((pop-up-frames t))
                            (display-buffer (get-buffer-create "foo"))))'

I end up in the "*scratch*" buffer not in "foo".  It would be more
consistent if the X11 version and the tty version would restore the
input focus to the same frame.  The tty version is the behavior that I
would expect.

Helmut.






  reply	other threads:[~2008-08-20 18:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48C8C046.50203@gmx.at>
2008-08-20  7:35 ` bug#745: pop-to-buffer, frames, and input focus Helmut Eller
2008-08-20 14:50   ` martin rudalics
2008-08-20 18:42     ` Helmut Eller [this message]
2008-08-20 20:42       ` David Reitter
2008-08-20 20:56       ` martin rudalics
2008-08-21  8:07         ` Helmut Eller
2008-08-21  9:04           ` martin rudalics
2008-08-21 13:20             ` Helmut Eller
2008-08-21 20:31               ` martin rudalics
2008-08-22 14:27                 ` Helmut Eller
2008-08-22 16:39                   ` martin rudalics
2008-08-23  8:55                     ` Helmut Eller
2008-08-23 12:05                       ` martin rudalics
2008-08-24 13:14                         ` Helmut Eller
2008-08-25 13:45                           ` martin rudalics
2008-08-26 21:45                             ` Helmut Eller
2008-08-27  8:12                               ` martin rudalics
2008-08-27 12:54                                 ` Helmut Eller
2008-08-28 11:46                                   ` martin rudalics
2008-08-28 16:47                                     ` Helmut Eller
2008-08-28 21:26                                       ` martin rudalics
2008-08-29  7:39                                         ` Helmut Eller
2008-08-29  9:26                                           ` martin rudalics
2008-08-29 15:02                                             ` Helmut Eller
2008-08-30  8:15                                               ` martin rudalics
2008-08-30 11:06                                                 ` Helmut Eller
2008-08-30 13:42                                                   ` martin rudalics
2008-08-31  8:55                                                     ` Helmut Eller
2008-09-06 11:56                                                       ` martin rudalics
2008-09-09  6:24                                                         ` Helmut Eller
2008-09-11  7:05   ` bug#745: marked as done (pop-to-buffer, frames, and input focus) Emacs bug Tracking System

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=m2tzdfcytz.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=745@emacsbugs.donarmstrong.com \
    --cc=rudalics@gmx.at \
    /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).