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

From: Michael Heerdegen <[email-masked]>
Date: Thu, 17 Aug 2023 02:55:34 +0200

Brandon Irizarry <[email-masked]> writes:

> To reproduce: in emacs invoked with '-Q', in the Scratch buffer, insert the
> following
> code:
>
> (require 'cl-macs)
>
> (cl-flet ((fn ((min max))
>      (message "%d %d" min max)))
>   (fn '(2 3)))
>
> The cl-flet form evaluates fine (e.g. with C-x C-e or C-M-x), which
> leads me to conclude that this construct is legal. However, attempting
> to instrument the form with Edebug (C-u C-M-x) results in an enormous
> backtrace starting with
>
> Debugger entered--Lisp error: (invalid-read-syntax "Expected" "lambda")

Thanks.  I agree.  This doesn't seem to be a new bug.

Edebug first tries to match (symbolp form), this is the first branch in
an &or - this calls `edebug-list-form' which binds edebug-gate --> t
and tries to
(edebug-match-specs cursor '(lambda-expr body) 'edebug-match-specs)
which doesn't match but errors because of the bound `edebug-gate'.

Who knows how to fix this correctly?

Michael.