Subject: bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me

From: Gregory Heytings <[email-masked]>
Date: Fri, 16 Sep 2022 18:26:48 +0000

>
> I'm not convinced that '--function-arg' is necessary, but I do think 
> that adding '--function' to emacsclient would be the best solution of 
> the ones presented so far.
>

It's not very adaptable, whereas --eval allows you to run an arbitrary 
form.

>
> That would allow both of the following in .desktop files:
>
> emacsclient --function my-function-taking-one-url %u
> emacsclient --function my-function-taking-many-urls %U
>

Sure, and how would you use it say in shell scripts, in which these 
%u/%U/%f/%F constructs do not exist?

>
> '--setq' has the disadvantage that you'd need some way to prepend *each* 
> URL/filename with it in the %U/%F cases.
>

What about --setq args "(list %U)"?

>
> The functions above would need to be able to consume command-line 
> arguments (like 'message-mailto' does), but that's not a big deal. We 
> could even add an 'apply-from-command-line' function that adapts any 
> existing function to do this:
>
> emacsclient --function apply-from-command-line func arg1 arg2
>
> 'apply-from-command-line' could look at the arity of 'func' and consume 
> the appropriate number of command-line arguments.
>

That's over-engineering IMO.

>
> Adding '--function' to emacsclient also has the advantage that it's 
> already available for emacs,
>

No, emacs only has --funcall: call Emacs Lisp function FUNC with no 
arguments.