bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19613: 25.0.50; cl-labels bug


From: Katsumi Yamaoka
Subject: bug#19613: 25.0.50; cl-labels bug
Date: Mon, 26 Jan 2015 14:57:49 +0900
User-agent: Gnus/5.130012 (真 Gnus v0.12) Emacs/25.0.50 (i686-pc-cygwin)

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

--- 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))))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]