[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: switch-to-buffer-other-frame changes focus/mouse to that other frame

From: martin rudalics
Subject: Re: switch-to-buffer-other-frame changes focus/mouse to that other frame
Date: Sat, 16 Oct 2010 09:56:32 +0200
User-agent: Thunderbird (Windows/20090302)

>   A "switch-to-buffer-other-frame" switches to a (newly created)
>   frame, but keeps the focus (and the mouse) on it's current
>   location in
>     GNU Emacs 22.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.12.0)
>     of 2008-05-16 on willimas
>   as a "switch-to-buffer-other-window" (with pop-up-frames==f) does.
>   However, the same "switch-to-buffer-other-frame" in
>     GNU Emacs 23.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.18.6)
>     of 2010-04-01 on build17
>   gives the focus to (and places the mouse in) the (newly created)
>   frame.
>   I don't want to focus on the other-frame in this situation.
> How can I avoid this behavior of Emacs 23.1.1?

You can't, due to possible race conditions with the window manager :-(

Note that `switch-to-buffer-other-frame' is not a good example in this
context.  By design, this function permanently selects the window it
uses for showing the buffer and, implicitly, that window's frame.  Hence
it's only natural that it does also focus that frame.

But the problem you describe already occurs with `display-buffer' which,
by design, should _not_ select the window where it displays the buffer.
If, however, `display-buffer' shows the buffer in a new frame, it also
transfers focus to that frame and raises it.  Emacs 23 transfers focus
even when it _reuses_ an existing frame - there was a longer discussion
on this somehwere around 2007 or 2008 but I don't recall the title of
the thread any more.

It's probably most instructive to look at the rather ill-fated function
`display-buffer-other-frame' in files.el.  If we can fix this, we could
try to make the do-not-transfer-focus behavior optional at least on all
those systems that support it reliably.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]