Subject: Re: bug#7658: 24.0.50; emacsclient not raising frame

From: [email-masked]
Date: Wed, 06 Jul 2011 19:03:24 -0400

Juanma Barranquero <[email-masked]> writes:

> On Thu, Dec 16, 2010 at 23:23,  <[email-masked]> wrote:
>
>> From the command line I can see:
>>
>> emacs-24.0.50\bin\emacsclient.exe: connected to remote socket at
>> xxx.xx.x.xxx
>>
>> So I can see that it made the connection (I removed the real IP adress)
>> but the frame is not raised.
>
> IIUC, the connection is remote, i.e., you're invoking emacsclient in
> one computer, and emacs is running in another one (both Windows, I
> suppose).

No, both emacs and emacsclient are invoked on the same Windows computer.

>
> In that case, there's nothing we can do. The trend on newer Windows is
> to give the user, not the programs, the control of the focus, so
> programs requesting it do not normally get it.
>
> However, a program that already has the focus can pass the privilege,
> so to speak, to another one. When you run emacsclient, it has the
> focus. So, it tries to detect a running Emacs in the same computer
> with the right pid, and if it finds it, it calls a Windows API,
> AllowSetForegroundWindow, to pass it the focus. But obviously this
> does not work for a program in a remote computer; not even if one of
> the computers is just a virtual machine running in the other one.

Thanks for this information.

A virtual machine is not involved.

The Emacs tile (at the bottom of the screen) turns orange for a few
seconds but the Emacs instance (frame) does not come to the forefront
if it is already deiconified.

However, if it is iconified, emacsclient (calling `select-frame-by-name')
does deiconify it, as expected.

So the problem appears to be when it is deiconified and then calling
`select-frame-by-name'.

Thanks.

> Â  Â  Juanma