Subject: Re: bug#2025: 23.0.60; emacsclient: frame does not get focus on opening

From: Stephen Berman <[email-masked]>
Date: Wed, 05 Oct 2011 10:31:31 +0200

On Wed, 05 Oct 2011 00:48:00 -0400 Glenn Morris <[email-masked]> wrote:

> Stephen Berman wrote:
>
>> If I use server-start, then frames opened by `emacsclient -c' do not
>> automatically get desktop focus:
>>
>> emacs -Q -f server-start
>> emacsclient -c
>> => The frame that appears does not have desktop focus (rather, the xterm
>> window still has focus).
>
> I cannot reproduce this. Do you still see it?

Yes; however, ...

> (I know nothing about this; doesn't the window manager have some control
> over it?)

Apparently, though I didn't think to test this in my OP.  But now I see
this problem with KWin (currently KDE 4.7.1, on openSUSE 11.4), starting
Emacs either from Konsole or Xterm, but not with IceWM (I don't have
Gnome on this system).

Also, my recipe was a bit imprecise: either the first line should end
with `&' or you have to background the process to invoke emacsclient.
Moreover, I see a peculiar difference between Konsole and Xterm on KWin:
Invoking `emacs -Q -f server-start' (with or without '&') from Konsole
opens a frame which gets focus, but when invoked from Xterm, this frame,
too, does not get focus.  Whereas with both terminal emulators, frames
opened by `emacsclient -c' fail to get focus.

Again, this is after initially starting Emacs with server-start; as my
OP noted, starting with --daemon, subsequent invocations of `emacsclient
-c' do open a frame with focus -- at least when invoked from Konsole:
with Xterm there seems to be some kind of race condition, because
sometimes the frame gets focus, sometimes it doesn't.

Anyway, it looks like this may not be a problem that can be solved by
Emacs, so I suppose this bug can be closed.

Steve Berman