summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-macs.el
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2022-03-03 19:56:09 +0100
committerPhilipp Stephani <phst@google.com>2022-03-03 19:57:00 +0100
commitaeb25f9d3d12a18ef3881e23b32a34615355d4d0 (patch)
treefb5dd277fb3bd36e5d807557962910ab3aacdca0 /lisp/emacs-lisp/cl-macs.el
parentdc8a692f97fdafaa31001ab0620394525103ddb7 (diff)
downloademacs-aeb25f9d3d12a18ef3881e23b32a34615355d4d0.tar.gz
emacs-aeb25f9d3d12a18ef3881e23b32a34615355d4d0.tar.bz2
emacs-aeb25f9d3d12a18ef3881e23b32a34615355d4d0.zip
Teach Edebug about the special '&whole' syntax for compiler macros.
* lisp/emacs-lisp/cl-macs.el (cl-define-compiler-macro-list): New Edebug element specification. (cl-define-compiler-macro): Use it. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-define-compiler-macro/edebug): New unit test.
Diffstat (limited to 'lisp/emacs-lisp/cl-macs.el')
-rw-r--r--lisp/emacs-lisp/cl-macs.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 50852172505..accd70dc4ef 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3489,6 +3489,10 @@ omitted, a default message listing FORM itself is used."
;;; Compiler macros.
+(def-edebug-elem-spec 'cl-define-compiler-macro-list
+ `(([&optional "&whole" arg]
+ ,@(car (get 'cl-macro-list 'edebug-elem-spec)))))
+
;;;###autoload
(defmacro cl-define-compiler-macro (func args &rest body)
"Define a compiler-only macro.
@@ -3501,7 +3505,10 @@ compiler macros are expanded repeatedly until no further expansions are
possible. Unlike regular macros, BODY can decide to \"punt\" and leave the
original function call alone by declaring an initial `&whole foo' parameter
and then returning foo."
- (declare (debug cl-defmacro) (indent 2))
+ ;; Like `cl-defmacro', but with the `&whole' special case.
+ (declare (debug (&define name cl-define-compiler-macro-list
+ cl-declarations-or-string def-body))
+ (indent 2))
(let ((p args) (res nil))
(while (consp p) (push (pop p) res))
(setq args (nconc (nreverse res) (and p (list '&rest p)))))