From f3df7916b2b342380930082cf35bad6cb488a4dc Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Mon, 14 Mar 2022 10:59:03 +0100 Subject: [PATCH] Make Edebug specification for 'cl-defstruct' more lenient. For example, 'xref-item' uses the list form of ':noinline'. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Accept ':noinline' and ':named' with an argument. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct/edebug): New unit test. --- lisp/emacs-lisp/cl-macs.el | 3 ++- test/lisp/emacs-lisp/cl-macs-tests.el | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 4b231d81496..9fd3350ddd7 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2911,7 +2911,8 @@ To see the documentation for a defined struct type, use [":include" symbolp &rest sexp] ;; Not finished. [":print-function" sexp] [":type" symbolp] - [":named"] + [":noinline" &optional sexp] + [":named" &optional sexp] [":initial-offset" natnump])])] [&optional stringp] ;; All the above is for the following def-form. diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 036ee30966b..19ede627a13 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -709,4 +709,22 @@ collection clause." ;; Just make sure the forms can be instrumented. (eval-buffer)))) +(ert-deftest cl-defstruct/edebug () + "Check that we can instrument `cl-defstruct' forms." + (with-temp-buffer + (dolist (form '((cl-defstruct cl-defstruct/edebug/1) + (cl-defstruct (cl-defstruct/edebug/2 + :noinline)) + (cl-defstruct (cl-defstruct/edebug/3 + (:noinline t))) + (cl-defstruct (cl-defstruct/edebug/4 + :named)) + (cl-defstruct (cl-defstruct/edebug/5 + (:named t))))) + (print form (current-buffer))) + (let ((edebug-all-defs t) + (edebug-initial-mode 'Go-nonstop)) + ;; Just make sure the forms can be instrumented. + (eval-buffer)))) + ;;; cl-macs-tests.el ends here -- 2.39.5