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

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

bug#62563: [FR] Expose `interactive' arg handling as an Elisp function


From: Michael Heerdegen
Subject: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function
Date: Sun, 17 Sep 2023 02:50:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Kangas <stefankangas@gmail.com> writes:

> >> --8<---------------cut here---------------start------------->8---
> >> (defun foo (fname)
> >>   (interactive "f")
> >>   (ignore fname))
> >>
> >> (defun foo (fname bar)
> >>   (interactive
> >>    (list (simulate-interactive-f)
> >>          (get-bar)))
> >>   (ignore fname bar))
> >> --8<---------------cut here---------------end--------------->8---

Something like this can be useful if you need to read an additional
argument in a way that involves the need to run some Lisp, where using a
normal code letter is not enough.  Then you need to substitute the other
code letters you still want to have been read also with Lisp code.  Is
that understandable?

We have `advice-eval-interactive-spec' which can be used like
(advice-eval-interactive-spec "f") - that comes very close to what is
requested here.  Combined with `interactive-form' one can use this to
simulate the argument reading from a given command from Lisp.

`advice-eval-interactive-spec' has a FIXME:

| ;; FIXME: How about renaming this to just `eval-interactive-spec'?
| ;; It's not specific to the advice system.

Any opinions whether we want to do that?  If the implementation is not
something ugly (it probably is, a bit, though), I would vote for it.

Michael.





reply via email to

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