GNU bug report logs - #19613
25.0.50; cl-labels bug

Previous Next

Package: emacs;

Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>

Date: Fri, 16 Jan 2015 05:20:02 UTC

Severity: normal

Found in version 25.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 19613 <at> debbugs.gnu.org
Subject: bug#19613: 25.0.50; cl-labels bug
Date: Mon, 26 Jan 2015 14:57:49 +0900
[Message part 1 (text/plain, inline)]
On Thu, 22 Jan 2015 16:07:17 +0900, Katsumi Yamaoka wrote:
> I have still a problem with `cl-labels' used within `lexical-let'.

> (lexical-let (var)
>   (cl-labels ((fn (arg) arg))
>     (apply #'fn (list "arg"))))
>  => apply: Symbol's function definition is void: fn

When a `cl-labels' form is wrapped with `lexical-let', it runs
`cl--function-convert' instead of `cl--labels-convert'.
So, `cl--function-convert' also needs to be fixed like the ones
Stefan did in `cl--labels-convert'[1], doesn't it?  I tried the
attached patch and verified it fixes not only the `cl-labels'
bug but also the `cl-flet' bug[2].

[1] git diff -U 9d940c6 69f36af lisp/emacs-lisp/cl-macs.el
[2]
(lexical-let (var)
  (cl-flet ((fn (arg) arg))
    (apply #'fn (list "arg"))))
 => apply: Symbol's function definition is void: fn

[Message part 2 (text/x-patch, inline)]
--- cl.el~	2015-01-26 04:16:45.291325300 +0000
+++ cl.el	2015-01-26 05:53:38.810655900 +0000
@@ -374,10 +374,12 @@
           (setq cl--function-convert-cache (cons newf res))
           res))))
    (t
-    (let ((found (assq f macroexpand-all-environment)))
-      (if (and found (ignore-errors
-                       (eq (cadr (cl-caddr found)) 'cl-labels-args)))
-          (cadr (cl-caddr (cl-cadddr found)))
+    (let* ((found (assq f macroexpand-all-environment))
+           (replacement (and found
+                             (ignore-errors
+                               (funcall (cdr found) cl--labels-magic)))))
+      (if (and replacement (eq cl--labels-magic (car replacement)))
+          (nth 1 replacement)
         (let ((res `(function ,f)))
           (setq cl--function-convert-cache (cons f res))
           res))))))

This bug report was last modified 10 years and 168 days ago.

Previous Next


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