GNU bug report logs - #65344
28.2; Unable to Edebug cl-flet form which uses argument destructuring

Previous Next

Package: emacs;

Reported by: Brandon Irizarry <brandon.irizarry <at> gmail.com>

Date: Wed, 16 Aug 2023 18:23:02 UTC

Severity: normal

Found in version 28.2

Fixed in version 30.1

Done: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, brandon.irizarry <at> gmail.com, Mattias Engdegård <mattias.engdegard <at> gmail.com>, Michael Albinus <michael.albinus <at> gmx.de>, 65344 <at> debbugs.gnu.org
Subject: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring
Date: Sun, 03 Sep 2023 12:09:53 -0400
>>                          (prog1
>>                              #'(lambda (y)
>>                                 (edebug-enter 'edebug-anon5 (list y)
>>                                  #'(lambda nil :closure-dont-trim-context
>>                                     (edebug-after (edebug-before 0) 3
>
> And here again the same mechanism, but with a bogus name.  That's what
> you are referring to, right?

While in this specific case it would be technically possible to give it
a better name, it's somewhere between hard and impossible to do it in
general, so I'm not bothered by this "bogus name": that's already what
is used in all other cases where anonymous functions are encountered.

> Do you perhaps an idea how to solve that?

I'm proposing we revert to the code we had originally, which avoids
creating the spurious `f <at> cl-flet <at> 4`.
[ Tho with extra comments to explain why there's no `&name` on the
  (symbolp form) case.  ]

After all, your original report was due to a misunderstanding, thinking
that `(cl-flet ((a ((b c)))) body)` treated `((b c))` as an arg list
(for a function with an empty body) like Common Lisp's `flet` does,
whereas `cl-flet` treats it as an expression (that returns the function).


        Stefan


diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 850fbc69180..8d92acb0c95 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2075,15 +2075,16 @@ cl-flet
 
 \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
   (declare (indent 1)
-           (debug ((&rest [&or (&define [&name symbolp "@cl-flet@"]
+           ;; The first (symbolp form) case doesn't use `&name' because
+           ;; it's hard to associate this name with the body of the function
+           ;; that `form' will return (bug#65344).
+           (debug ((&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)
-                               (&define [&name symbolp "@cl-flet@"]
-                                        [&name [] gensym] ;Make it unique!
-                                        def-form)])
+                                        def-body)])
                    cl-declarations body)))
   (let ((binds ()) (newenv macroexpand-all-environment))
     (dolist (binding bindings)





This bug report was last modified 1 year and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.