This issue intrigued me so I kept looking into it and here's what I've
found.

In Windows 7 and newer, the shell (Explorer.exe) changed the behavior of
the taskbar, and groups taskbar items (processes, files, windows, etc.) to
make it easier to find what you're working on (and share features like the
jumplists and taskbar preview).  In order to do that, the shell needs a way
of identifying what to group.It does this using the "Application User Model
ID".  (See
https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
and http://blogs.msdn.com/b/oldnewthing/archive/2012/08/20/10341464.aspx
for some good details.)

The Windows shell uses some heuristics to try to identify what should be
grouped but it isn't perfect. For example, for programs started via
shortcuts, the target in the shortcut must be the same.  So if you have two
shortcuts to the same program but with different command line parameters,
they would be considered different and not be grouped.  For processes it
assumes only processes with the same name should be grouped. And that's the
situation with Emacs - emacs.exe and runemacs.exe aren't considered the
same by the Windows shell and it doesn't group the icons on the taskbar and
similar undesired behavior we see.

Microsoft says the way to solve this is to explicitly set an AppID which
overrides the heuristics. So for better behavior in Windows 7 and later,
all emacs processes (emacs.exe, runemacs.exe, emacsclientw.exe, etc.)
should be modified to call SetCurrentProcessExplicitAppUserModelID() during
their startup.

I'll look into putting a bug in and take a look at the code.  But until
that's changed, you can use this program:
https://code.google.com/p/win7appid/ (thanks to Michael Hoffman who already
noted this on Emacswiki here: http://www.emacswiki.org/emacs/EmacsW32#toc51
).

To use it locate the shortcut you have pinned to the taskbar and run this
program on it.  It's a command-line program, see the win7appid page for
more.  Pinned taskbar items are usually in
<windows-drive>:\Users\<username>\ApplicationData\Microsoft\Internet
Explorer\Quick Launch\User Pinned\TaskBar.
The AppId to use would be "GNU.Emacs".

I've tried it and it fixes things, and the David, the OP, confirmed it
worked for him in a private email.

On Fri, Sep 25, 2015 at 1:46 PM, David Vanderschel <d...@austin.rr.com>
wrote:

> In Windows 7 and 8.1, we had the following solution:  Start Emacs with
> runemacs.exe, pin it, close it, bring up the Properties for the pinned
> icon, and change the target from emacs.exe to runemacs.exe.  That works as
> one would hope: either starting an instance of Emacs or activating any
> existing instance.
>
> My habit for starting Emacs or activating an existing instance is to use
> Windows-digit or (equivalently) clicking the pinned taskbar icon.  With
> Windows 10, it does not work.  When I start Emacs with the taskbar icon, it
> adds a new icon to the taskbar for the running instance.  If I use the
> pinned icon again, it starts yet another instance.  Windows-digit becomes
> useless because I don't know the digit corresponding to the *running*
> instance of Emacs.
>
> Could someone please point me to a solution for Windows 10?  (If there is
> not one, I guess I will resort to AHC.)
>
> Regards,
>   David V.
>

Reply via email to