GNU bug report logs - #57752
28.1.91; emacsclient-mail.desktop doesn't work for me

Previous Next

Package: emacs;

Reported by: Damien Cassou <damien <at> cassou.me>

Date: Mon, 12 Sep 2022 18:32:01 UTC

Severity: normal

Merged with 59743

Found in version 28.1.91

Full log


Message #71 received at 57752 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Gregory Heytings <gregory <at> heytings.org>,
 Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: Damien Cassou <damien <at> cassou.me>, Robert Pluim <rpluim <at> gmail.com>,
 57752 <at> debbugs.gnu.org, git <at> mavit.org.uk, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me
Date: Fri, 16 Sep 2022 10:21:56 -0700
On 9/16/2022 9:42 AM, Gregory Heytings wrote:
>>> And why is the above easier / better than
>>>
>>> emacsclient --eval '(progn (fun1 arg1 arg2) (fun2 arg3))'
>>
>> Because, with this, you have to correctly format the arguments with 
>> appropriate quoting into a lisp program, rather than just passing them 
>> straight in.  If the arguments are input from something else, this is 
>> harder than it appears.  Bad quoting is a common source of bugs 
>> (things like SQL injection, for example).
>>
> 
> If that's the intended use case, IMO instead of adding two --function 
> and --function-arg arguments it would be much clearer to add a --setq 
> parameter:
> 
> emacsclient --setq arg1 ... --setq arg2 ... --setq arg3 ... --eval 
> '(progn (fun1 arg1 arg2) (fun2 arg3))'

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. 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

(Likewise for %f/%F, which expands to one/many file names.) '--setq' has 
the disadvantage that you'd need some way to prepend *each* URL/filename 
with it in the %U/%F cases.

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.

Adding '--function' to emacsclient also has the advantage that it's 
already available for emacs, so it's not really an all-new feature so 
much as it is just adding a new place you can use it from. The semantics 
of '--function' are already set, and should work just fine for the cases 
described in this bug.




This bug report was last modified 1 year and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.