Subject: Re: bug#64459: 30.0.50; Edebug can't instrument certain syntax-propertize-rules forms

From: Stefan Monnier <[email-masked]>
Date: Tue, 04 Jul 2023 16:56:36 -0400

> (defun foo () (syntax-propertize-rules ((concat ""))))
>
> Now try to instrument this using C-u C-M-x.  This will lead to an error
> "Eager macro-expansion failure":
>
> Debugger entered--Lisp error: (error "Eager macro-expansion failure: (void-function edeb...")
>   signal(error ("Eager macro-expansion failure: (void-function edeb..."))

I think the patch below should fix this problem.
Can you confirm that it fixes it for you in a more realistic setting?

        Stefan

diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index d610fa005cc..002a24af18b 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -249,11 +249,12 @@ syntax-propertize-rules
 Note: There may be at most nine back-references in the REGEXPs of
 all RULES in total."
   (declare (debug (&rest &or symbolp    ;FIXME: edebug this eval step.
-                         (form &rest
-                               (numberp
-                                [&or stringp ;FIXME: Use &wrap
-                                     ("prog1" [&or stringp def-form] def-body)
-                                     def-form])))))
+                         (def-form
+                          &rest
+                          (numberp
+                           [&or stringp ;FIXME: Use &wrap
+                                ("prog1" [&or stringp form] def-body)
+                                form])))))
   (let ((newrules nil))
     (while rules
       (if (symbolp (car rules))