Subject: bug#38314: No /usr/share/applications mailto presence

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 11 Aug 2020 15:05:30 +0200

Gĳs Hillenius <[email-masked]> writes:

> The sample file uses:
> Exec=emacs -f message-mailto %u
>
> Would this work as well?
> Exec=/usr/bin/emacsclient.emacs-snapshot -f message-mailto
>
> I'll experiment with this once it is included in the next snapshot for Debian.

Hm.  No, it won't work, because -f in emacsclient means:

       -f, --server-file=FILENAME
              use TCP configuration file FILENAME for communication.  This can
              also  be  specified  via the EMACS_SERVER_FILE environment vari‐
              able.

So I think that would be

emacsclient -e (message-mailto) %u

?

Or does the Emacs -f thing hide under a different option in emacsclient?  

Hm, no, that doesn't work, obviously, because message-mailto expects the
%u in command-line-args-left, and that's not the case here.

So it's

emacsclient -e '(message-mailto-1 \"%u\")'

which has major problems with string interpolation and would be very
fragile.

Would it make sense to add something to emacsclient/emacs-server to help
in this use case?

So a new switch, like "-E", which means "emulate as far as possible
'emacs -f'":

emacsclient -E message-mailto %u

In emacs-server, this would bind command-line-args-left to the remaining
parameters, and then funcall the function.

I'm kinda surprised that emacsclient doesn't have something like this
already?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no