bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Jim Porter
Subject: bug#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me
Date: Mon, 19 Sep 2022 09:05:52 -0700

On 9/19/2022 1:56 AM, Gregory Heytings wrote:
Hmm...  I did not see the --apply proposal earlier, it's nice and lispy indeed.

I think I would prefer to separate the two concerns (stuffing argument strings into the Lisp environment on the one hand, and forms on the other hand), but it seems good enough, and perhaps it's the best compromise.

One disadvantage I see is that it becomes a bit more complex to write function calls with arguments that are not strings.  E.g. to call

(some-func 1 "arg" t)

one would have to do something like

--eval '(defun tmp-func (arg) (some-func 1 arg t))' --apply tmp-func arg

instead of something like

--set args arg -- --eval '(some-func 1 (car args) t)'

If Emacs gained a 'set-arg' function (similar to 'setarg1' in your message) that does the right thing, you could say:

  --apply set-arg args arg -- --eval '(some-func 1 (car args) t)'

Another way would be a function that "intelligently" converts arguments to other types. This is similar to how Eshell command forms work: if you're calling a Lisp function with sh-like syntax, it will automatically convert arguments that look like numbers into actual numbers. So maybe you could do something like:

  --apply autoconvert-strings-and-apply some-func 1 arg t

That seems clumsier to me than 'set-arg', but since these could all be written as Lisp functions, users or package authors should be able to do whatever they need. Of course, core Emacs could add whichever helper function(s) seem generally useful.

One case in which --apply is better is when the function is already defined by Emacs...

Yeah, for more-complex forms, you'd still need to fall back to --eval or something similar. But a Lisp function like 'set-arg' could let us reuse the --apply machinery. I think it could be as simple as this:

  (defun set-arg (name &rest value)
    (set (intern name) value))

That should give us '--set', except that it's spelled '--apply set-arg'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]