GNU bug report logs -
#745
pop-to-buffer, frames, and input focus
Previous Next
Full log
Message #25 received at 745 <at> emacsbugs.donarmstrong.com (full text, mbox):
> 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?
With emacs -Q evaluating
(let ((pop-up-frames t)
(buffer (get-buffer-create "foo")))
(pop-to-buffer buffer))
here gets me a new frame on top of the previously selected one, the
window displaying buffer `foo' is the selected window, and when I now
start typing, characters get displayed in that window. What did you
expect and what did you get?
> 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 slightly confused because in your earlier scenario you bemoaned the
fact that the frame _was_ selected. All I wanted to say that raising a
frame, giving it input focus, and _not_ selecting it might be difficult.
> 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/
I moved `pop-to-buffer' to window.el so you can easier try to play
around with it and propose a solution that fits your needs ;-)
> 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.
You have a point here but it's not up to me to decide that.
> 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.
When I do
(save-window-excursion
(let ((pop-up-frames t))
(display-buffer (get-buffer-create "foo"))))
in the *scratch* buffer I end up in `foo' - whether this is TRT I don't
know. Doing a `save-window-excursion' on the command line is beyond my
comprehension.
martin
This bug report was last modified 16 years and 255 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.