]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix debug spec of cl-flet (bug#65344)
authorGerd Möllmann <gerd@gnu.org>
Mon, 21 Aug 2023 07:16:17 +0000 (09:16 +0200)
committerGerd Möllmann <gerd@gnu.org>
Mon, 21 Aug 2023 07:27:49 +0000 (09:27 +0200)
* lisp/emacs-lisp/cl-macs.el (cl-flet): Fix debug spec.
(cl-defun): Allow only symbols as function names in debug spec.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-flet/edebug): New test
case.

lisp/emacs-lisp/cl-macs.el
test/lisp/emacs-lisp/cl-macs-tests.el

index a2e36fa3582bda87bbd4eca89b5da862fd1f9cbb..4cc43995c1256a253cd123f56e3028e824a22dd4 100644 (file)
@@ -389,7 +389,7 @@ more details.
 \(fn NAME ARGLIST [DOCSTRING] BODY...)"
   (declare (debug
             ;; Same as defun but use cl-lambda-list.
-            (&define [&name sexp]   ;Allow (setf ...) additionally to symbols.
+            (&define [&name symbolp]
                      cl-lambda-list
                      cl-declarations-or-string
                      [&optional ("interactive" interactive)]
@@ -2075,13 +2075,15 @@ info node `(cl) Function Bindings' for details.
 
 \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
   (declare (indent 1)
-           (debug ((&rest [&or (symbolp form)
-                               (&define [&name symbolp "@cl-flet@"]
+           (debug ((&rest [&or (&define [&name symbolp "@cl-flet@"]
                                         [&name [] gensym] ;Make it unique!
                                         cl-lambda-list
                                         cl-declarations-or-string
                                         [&optional ("interactive" interactive)]
-                                        def-body)])
+                                        def-body)
+                               (&define [&name symbolp "@cl-flet@"]
+                                        [&name [] gensym] ;Make it unique!
+                                        def-form)])
                    cl-declarations body)))
   (let ((binds ()) (newenv macroexpand-all-environment))
     (dolist (binding bindings)
index 983cbfc8bc705bb00fbae7e907be6450161952fa..56a49fd865a11fb53626b26cf35b1afac034f6ef 100644 (file)
@@ -708,6 +708,23 @@ collection clause."
                            (f lex-var)))))
       (should (equal (f nil) 'a)))))
 
+(ert-deftest cl-flet/edebug ()
+  "Check that we can instrument `cl-flet' forms (bug#65344)."
+  (with-temp-buffer
+    (print '(cl-flet (;; "Obscure" form of binding supported by cl-flet
+                      (x (progn (list 1 2) (lambda ())))
+                      ;; Destructuring lambda-list
+                      (y ((min max)) (list min max))
+                      ;; Regular binding plus shadowing.
+                      (z (a) a)
+                      (z (a) a))
+              (y '(1 2)))
+           (current-buffer))
+    (let ((edebug-all-forms t)
+          (edebug-initial-mode 'Go-nonstop))
+      ;; Just make sure the forms can be instrumented.
+      (eval-buffer))))
+
 (ert-deftest cl-macs--progv ()
   (defvar cl-macs--test)
   (defvar cl-macs--test1)