all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Gregory Heytings <gregory@heytings.org>,
	Peter Oliver <p.d.oliver@mavit.org.uk>
Cc: Damien Cassou <damien@cassou.me>, Robert Pluim <rpluim@gmail.com>,
	57752@debbugs.gnu.org, git@mavit.org.uk,
	Lars Ingebrigtsen <larsi@gnus.org>, Eli Zaretskii <eliz@gnu.org>
Subject: bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me
Date: Fri, 16 Sep 2022 10:21:56 -0700	[thread overview]
Message-ID: <4712c3c2-dfca-c6a4-2840-13d20cffb7b8@gmail.com> (raw)
In-Reply-To: <84acc36e7e2d900b70c0@heytings.org>

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.





  reply	other threads:[~2022-09-16 17:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 18:31 bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me Damien Cassou
2022-09-13 12:19 ` Lars Ingebrigtsen
2022-09-13 13:29   ` Damien Cassou
2022-09-13 13:41     ` Eli Zaretskii
2022-09-13 13:58       ` Damien Cassou
2022-09-13 14:57         ` Robert Pluim
2022-09-13 15:32           ` Damien Cassou
2022-09-15 18:30         ` Jim Porter
2022-09-16  9:54           ` Lars Ingebrigtsen
2022-09-16 10:09             ` Robert Pluim
2022-09-16 10:14               ` Lars Ingebrigtsen
2022-09-16 14:18                 ` Robert Pluim
2022-09-16 15:21                   ` Jim Porter
2022-09-16 12:38               ` Damien Cassou
2022-09-16 12:50                 ` Gregory Heytings
2022-09-16 14:46                   ` Damien Cassou
2022-09-16 15:07                     ` Gregory Heytings
2022-09-16 16:18                       ` Peter Oliver
2022-09-16 16:42                         ` Gregory Heytings
2022-09-16 17:21                           ` Jim Porter [this message]
2022-09-16 18:26                             ` Gregory Heytings
2022-09-16 19:33                               ` Jim Porter
2022-09-16 20:04                                 ` Gregory Heytings
2022-09-18 13:58                                   ` Robert Pluim
2022-09-16 14:19                 ` Robert Pluim
2022-09-16 14:47                   ` Damien Cassou
2022-09-16 15:17             ` Jim Porter
2022-09-18 10:23               ` Lars Ingebrigtsen
2022-09-18 14:46                 ` Robert Pluim
2022-09-19  8:09                   ` Lars Ingebrigtsen
2022-09-18 18:31                 ` Jim Porter
2022-09-19  8:12                   ` Lars Ingebrigtsen
2022-09-19 15:48                     ` Jim Porter
2022-09-19 18:45                       ` Lars Ingebrigtsen
2022-09-19  8:56                 ` Gregory Heytings
2022-09-19 12:00                   ` Lars Ingebrigtsen
2022-09-19 16:05                   ` Jim Porter
2022-09-19 17:01                     ` Gregory Heytings
2022-12-02 14:52     ` Max Nikulin
2023-07-26  5:14       ` Max Nikulin
2022-09-16 19:42   ` Jim Porter
2022-09-18 10:26     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4712c3c2-dfca-c6a4-2840-13d20cffb7b8@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=57752@debbugs.gnu.org \
    --cc=damien@cassou.me \
    --cc=eliz@gnu.org \
    --cc=git@mavit.org.uk \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.org \
    --cc=p.d.oliver@mavit.org.uk \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.