[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a30781399b3: * subr-x (eval-command-interactive-spec): New functi
From: |
Sean Whitton |
Subject: |
master a30781399b3: * subr-x (eval-command-interactive-spec): New function. |
Date: |
Mon, 5 Jun 2023 03:36:34 -0400 (EDT) |
branch: master
commit a30781399b3ef48150b9cb13cb0aeba7086c2d9e
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>
* subr-x (eval-command-interactive-spec): New function.
---
etc/NEWS | 5 +++++
lisp/emacs-lisp/nadvice.el | 2 ++
lisp/emacs-lisp/subr-x.el | 7 +++++++
3 files changed, 14 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index 9529282f047..910472e5519 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -648,6 +648,11 @@ Since circular alias chains now cannot occur,
'function-alias-p',
'indirect-function' and 'indirect-variable' will never signal an error.
Their 'noerror' arguments have no effect and are therefore obsolete.
+---
+** 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/nadvice.el b/lisp/emacs-lisp/nadvice.el
index e457387acc9..e6977f2012a 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -165,6 +165,8 @@ DOC is a string where \"FUNCTION\" and \"OLDFUN\" are
expected.")
(buffer-string))
usage))))
+;; FIXME: How about renaming this to just `eval-interactive-spec'?
+;; It's not specific to the advice system.
(defun advice-eval-interactive-spec (spec)
"Evaluate the interactive spec SPEC."
(cond
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 9e906930b92..a7d8f785508 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -504,6 +504,13 @@ Used by `emacs-authors-mode' and `emacs-news-mode'."
(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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a30781399b3: * subr-x (eval-command-interactive-spec): New function.,
Sean Whitton <=