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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 15 Sep 2023 09:29:09 +0300

> From: Spencer Baugh <[email-masked]>
> Cc: Spencer Baugh <[email-masked]>,  [email-masked],
>    [email-masked]
> Date: Thu, 14 Sep 2023 11:10:44 -0400
> 
> We could make a command-line-args-left equivalent for emacsclient,
> called server-eval-args-left, which contains the FILE arguments passed
> to emacsclient as strings.  This can be done without making any changes
> to emacsclient.c or the server protocol.  Then the message-mailto
> use case would look like this:
> 
> emacsclient --eval '(message-mailto (pop server-eval-args-left))' %u
> 
> This would match how message-mailto uses (pop command-line-args-left)
> internally.
> 
> This would work for all the use-cases I described before; I'd be very
> happy with this solution (actually, I'm starting to prefer it to
> --apply).  And again, it doesn't change emacsclient.c or the server
> protocol.

This could perhaps be acceptable (although it's still rather kludgey,
IMO), but are you sure you understand all the consequences?
Currently, when emacsclient is invoked like this:

  $ emacsclient --eval '(func args)' foo bar

we send to the server the following commands:

  -eval (func args)
  -eval foo
  -eval bar

IOW, every command-line argument after --eval is treated as being
implicitly preceded with --eval.

With your proposal, how will the server know that some of "-eval foo"
commands should cause foo to be added to server-eval-args-left instead
of being evaluated as it does now?