Subject: bug#1980: 23.0.60; emacs switches focus to graphical frame when server-edit exits terminal frame

From: Gregor Zattler <[email-masked]>
Date: Sat, 4 Dec 2010 16:56:49 +0100

Hi Chong, Emacs developers, readers of old bug reports,
* Gregor Zattler <[email-masked]> [25. Mar. 2009]:
> * Chong Yidong <[email-masked]> [24. Mär. 2009]:
>>> When using emacs 23 in daemon mode some graphical emacs frame gets
>>> fokus if an editing session on a terminal window which was initiated
>>> via "emacsclient -t ..." is finished with C-x # (server-edit).  In
>>> order to continue work in the terminal window I have to manually
>>> switch back to the terminal window.
>> 
>> Sorry for the late response.  I haven't been able to reproduce this bug
>> with metacity---closing an `emacsclient -t' client keeps the xterm
>> window in focus.  This problem may be a quirk of the window managers you
>> tried (xfce4 and icwwm-lite); I am not sure what Emacs can do
>> differently to try to mitigate this.
> 
> O.k. I'll test it with other window managers.  ATM I don't have
> time to do this but I will report back when I've done it.

I did some tests and research today: This is not a WM issue, it's
reproducible without any WM.

Meanwhile this issue is discussed in bug 7269 as focus follows
mouse (actually: mouse follows frame).  The workaround mentioned
by Anders Kaseorg in the discussion of the aforementioned bug is
to

M-x customize-save-variable focus-follows-mouse n.

This works for me.  

But I think the default value of this variable is surprising and
it's documentation does not explain that this actually leads to
mouse movements.

Ciao, Gregor