>From 204582a0d8a85f5e411b76609440424353eeb744 Mon Sep 17 00:00:00 2001 From: Sean Whitton 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. + * 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