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 #98 received at 57752 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Damien Cassou <damien <at> cassou.me>, Eli Zaretskii <eliz <at> gnu.org>,
 git <at> mavit.org.uk, 57752 <at> debbugs.gnu.org
Subject: Re: bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me
Date: Sun, 18 Sep 2022 11:31:58 -0700
On 9/18/2022 3:23 AM, Lars Ingebrigtsen wrote:
> Jim Porter <jporterbugs <at> gmail.com> writes:
> 
>> 1) Instead of specifying the function args with a flag, I think I'd go
>> the other way and specify the function as being special, e.g.:
>>
>>    emacs --apply func arg1 arg2
> 
> Yes, that sounds good.  (But we'd still need "--" to say that the
> arguments have ended.)

This is actually the trickiest part about this to me. If I were 
designing this, I'd say that '--apply' consumes every positional 
argument up to the next flag. If it encounters a '--' while consuming 
arguments, *every* remaining argument gets passed to the function. That 
allows the following:

  emacs --apply func1 arg1 arg2 --apply func2 arg3 arg4 -Q
    => emacs -Q
       (func1 "arg1" "arg2")
       (func2 "arg3" "arg4")

  emacs --apply func -- --arg1 --arg2
    => emacs
       (func "--arg1" "--arg2")

This way, users can pass arguments beginning with a "-" to the function 
being applied while still retaining a fair amount of flexibility in 
other cases. It would also be good for shell scripts/aliases where you 
don't know ahead of time what the arguments will look like. If you had 
this in your shell environment:

  EDITOR="emacs --apply fancy-find-file"

then you might try to visit a file named "-Q". However, it would treat 
"-Q" as an argument to emacs instead. With what I suggested above, you'd 
just say:

  EDITOR="emacs --apply fancy-find-file --"

That's a common way of doing this for other command-line tools, so I 
think most people should understand the behavior fairly easily.

>> 2) Even better, why not just use --function and pass some higher-order
>> function:
>>
>>    emacs --function apply-from-command-line func arg1 arg2
> 
> I think that sounds more obscure, really (even if it's simpler to
> implement in the "emacs" case).

Either is fine with me. Originally, I thought that "--funcall 
apply-from-command-line ..."[1] might be nicer since you could replace 
'apply-from-command-line' with a fancier function, e.g. one that parses 
numeric values, but I think you'd be able to do that with --apply 
anyway. It's probably better to keep the simple path simple and go with 
--apply.

[1] I had meant to type --funcall instead of --function in my previous 
message, but got mixed up.




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

Previous Next


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