* Adding eval-command-interactive-spec
@ 2023-01-03 5:41 Sean Whitton
2023-01-15 18:00 ` Sean Whitton
0 siblings, 1 reply; 2+ messages in thread
From: Sean Whitton @ 2023-01-03 5:41 UTC (permalink / raw)
To: emacs-devel
I think that it would be useful to have this:
(defun eval-command-interactive-spec (command)
(advice-eval-interactive-spec
(cadr (or (and (symbolp command) (get command 'interactive-form))
(interactive-form command)))))
but I'm not sure where it should go -- nadvice.el? subr.el? subr-x.el?
--
Sean Whitton
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Adding eval-command-interactive-spec
2023-01-03 5:41 Adding eval-command-interactive-spec Sean Whitton
@ 2023-01-15 18:00 ` Sean Whitton
0 siblings, 0 replies; 2+ messages in thread
From: Sean Whitton @ 2023-01-15 18:00 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 895 bytes --]
Hello,
On Tue 03 Jan 2023 at 05:41AM GMT, Sean Whitton wrote:
> I think that it would be useful to have this:
>
> (defun eval-command-interactive-spec (command)
> (advice-eval-interactive-spec
> (cadr (or (and (symbolp command) (get command 'interactive-form))
> (interactive-form command)))))
>
> but I'm not sure where it should go -- nadvice.el? subr.el? subr-x.el?
I realised after reading the commentary in subr-x that that's exactly
where it should go -- it is a complement to the C API for interactive
calls. So, here's my patch to add eval-command-interactive-spec.
Seperately, how about renaming advice-eval-interactive-spec to
eval-interactive-spec, and obsoleting, but not removing, the old name?
I guess that we'd also want to move it to subr.el; this is no promotion,
so far as I can tell, because nadvice.el is preloaded.
--
Sean Whitton
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-subr-x-eval-command-interactive-spec-New-function.patch --]
[-- Type: text/x-patch, Size: 1522 bytes --]
From 204582a0d8a85f5e411b76609440424353eeb744 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Sun, 15 Jan 2023 10:57:30 -0700
Subject: [PATCH] * subr-x (eval-command-interactive-spec): New function.
---
etc/NEWS | 5 +++++
lisp/emacs-lisp/subr-x.el | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index a2924201267..d2e6b18cadd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -184,6 +184,11 @@ compared reliably at all.
This warning can be suppressed using 'with-suppressed-warnings' with
the warning name 'suspicious'.
+---
+** New function 'eval-command-interactive-spec' in the subr-x library.
+This function evaluates a command's interactive form and returns the
+resultant list.
+
\f
* Changes in Emacs 30.1 on Non-Free Operating Systems
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 8cdbdf1ef6a..0c52e5c25e9 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -488,6 +488,13 @@ emacs-etc--hide-local-variables
(progn (forward-line -1) (point))
(point-max)))))
+(defun eval-command-interactive-spec (command)
+ "Evaluate COMMAND's interactive form and return resultant list.
+If COMMAND has no interactive form, return nil."
+ (advice-eval-interactive-spec
+ (cadr (or (and (symbolp command) (get command 'interactive-form))
+ (interactive-form command)))))
+
(provide 'subr-x)
;;; subr-x.el ends here
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-15 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 5:41 Adding eval-command-interactive-spec Sean Whitton
2023-01-15 18:00 ` Sean Whitton
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).