Subject: bug#74018: 31.0.50; Issue with define-peg-ruleset?

From: Eli Zaretskii <[email-masked]>
Date: Sat, 26 Oct 2024 09:16:07 +0300

> Cc: [email-masked]
> Date: Fri, 25 Oct 2024 16:30:30 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> Version: 31.0.50
           ^^^^^^^
Given what you say below, this is inaccurate.

> Augusto pointed out a bug in `peg.el` when you have code like:
> 
>     (define-peg-ruleset myrules
>       (sign  () (or "+" "-" ""))
>       (digit () [0-9])
>       (nat   () digit (* digit))
>       (int   () sign digit (* digit))
>       (float () int "." nat))
> 
>     (with-peg-rules
>         (myrules
>          (complex float "+i" float))
>       (peg-parse nat "," nat "," complex) )
> 
> where the macroexpanded code is wrong and leads to errors like:
> 
>     Debugger entered--Lisp error: (void-function peg-rule\ nat)
> 
> I was about to install the bugfix below to `master` but noticed that it
> probably belongs to `emacs-30` instead since the bug makes
> `define-peg-ruleset` basically unusable and PEG is new in Emacs-30.
> 
> Any objection?

I know nothing about peg.el, and you haven't explained the root cause
for the bug for me to understand why it "makes `define-peg-ruleset'
basically unusable", so let's hear from Stefan and Andrea first.