Subject: Re: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring

From: Michael Heerdegen <[email-masked]>
Date: Fri, 18 Aug 2023 01:07:44 +0200

Gerd Möllmann <[email-masked]> writes:

> Not remembering much about Edebug, but cl-defun seems to work with
> Edebug.  So... :-)

Yes, this problem does not concern `cl-defun'.  This is the Edebug spec
of `cl-flet':

#+begin_src emacs-lisp
((&rest [&or (symbolp form)
             (&define [&name symbolp "@cl-flet@"]
                      [&name [] gensym] ;Make it unique!
                      cl-lambda-list
                      cl-declarations-or-string
                      [&optional ("interactive" interactive)]
                      def-body)])
 cl-declarations body)
#+end_src

Instrumenting a binding first tries (symbolp form): This is the syntax
where you can specify an expression to evaluate whose result is then
fbound.  Although we obviously have three elements to match in the
recipe case, Edebug tries nonetheless, and FORM raises an error because
it can't match ((min max)).  It should just cause backtracking, but the
implementation disables backtracking by purpose.

When you replace (symbolp form) with (symbolp sexp) the problem is gone.
But that only silences the problem: this also disables the
instrumentation of a form in that position.

I'm too dumb to fix this correctly.  We could transpose the two &or
branches in the spec, this works but it is also only a way to avoid the
problem.

Michael.