Subject: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping

From: Eli Zaretskii <[email-masked]>
Date: Thu, 14 Sep 2023 08:10:58 +0300

> Date: Wed, 13 Sep 2023 12:33:01 -0700
> Cc: [email-masked], [email-masked]
> From: Jim Porter <[email-masked]>
> 
> On 9/13/2023 12:13 PM, Eli Zaretskii wrote:
> > And I don't understand why we need to add any options to Emacs itself,
> > btw.  The suggestion to have some "symmetry" here was one of the
> > reasons that discussion got nowhere.  So let's learn from that
> > mistake, at least.
> 
> There's a practical benefit to this. If you have $EDITOR set in your 
> environment to something like "emacsclient --alternate-editor=emacs", 
> then it would be nice if you could say this:
> 
>    $EDITOR --apply some-func arg1 arg2
> 
> and have it do the same thing whether or not there was already an Emacs 
> server running. The symmetry between the two commands (plus proper 
> argument forwarding) would make that work.
> 
> However, if people can't agree, then we could probably drop that part. 
> To me, it sounds like people *do* agree that this would be good to have 
> though.

People might agree, but I don't.  Please consider the perspective.
This started as an obscure and rare problem in a desktop file (which
we provided solely out of good will, since it really isn't our job to
do so, it's the job of downstream distros).  The proposed solution was
to add a completely new option to emacsclient, with its own special
syntax and rules about what can and cannot be done with it.  This is
already something that should raise brows: how can such an unimportant
reason cause us to make such significant changes?  We didn't yet
finish discussing that nor even had time to understand all the
implications (remember: Lars suggested to support several such
options, which required another special option), and we already are
told that "for symmetry" we should add the same to Emacs.  All that
where just yesterday there was no need for any new options in either,
and if we decided to drop those desktop files from our sources (which
I personally am tempted to do every few weeks, due to issues they
cause us all the time since their introduction), then even the
original need will miraculously disappear into thin air.

So this is a classic case of the tail wagging the dog.

What about alternative solutions: use a shell script in the desktop
files, and delegate to that script to solve the problem with quoting?
Had anyone considered this strategy?  If not, why not?

I would in general prefer not to add any new options to our programs
due to this weak reason.  Once again: it is not our job to get these
desktop files right in every single downstream environment, so let's
not make it our problem, certainly not a problem we should solve using
such non-trivial solutions.