Subject: 25.1.50; emacsclient.desktop

From: Helmut Eller <[email-masked]>
Date: Tue, 29 Mar 2016 12:10:00 +0200

It would be useful to have a emacsclient.desktop file, because that
makes it possible to use emacsclient with docks/panels or the "Open
with" menu in some file managers.

Emacs already comes with emacs.desktop file, but that starts a new Emacs
process every time.  The emacsclient.desktop should use an existing
Emacs if there is one or start a new Emacs if there is none.

I created my own emacsclient.desktop (see below) but I think many people
would like something like that and it would be more efficient to ship a
good emacsclient.desktop with Emacs.

My version uses two (perhaps not so obvious) tricks:
1) the "-a emacs" part starts a new Emacs if no existing Emacs process
   can be found
2) adding +0 makes it possible to start emacsclient without file
   argument.  Emacs will then switch to the scratch buffer.

[Desktop Entry]
Name=Emacsclient
Comment=Tells a running Emacs to visit a file
Exec=emacsclient -a emacs --no-wait +0 %F
Icon=emacs24
Terminal=false
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Type=Application
Categories=Utility;Development;TextEditor;