all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: 19613@debbugs.gnu.org
Subject: bug#19613: 25.0.50; cl-labels bug
Date: Mon, 26 Jan 2015 14:57:49 +0900	[thread overview]
Message-ID: <b4mbnlmqe1u.fsf@jpl.org> (raw)
In-Reply-To: <b4m1tmv9ub4.fsf@jpl.org>

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 843 bytes --]

--- 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	other threads:[~2015-01-26  5:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16  5:19 bug#19613: 25.0.50; cl-labels bug Katsumi Yamaoka
2015-01-16 14:50 ` Stefan Monnier
2015-01-16 20:09   ` Glenn Morris
2015-01-17  3:57     ` Stefan Monnier
2015-01-22  7:07       ` Katsumi Yamaoka
2015-01-26  5:57         ` Katsumi Yamaoka [this message]
2015-01-26 15:14           ` Stefan Monnier
2015-01-26 23:00             ` Katsumi Yamaoka
2015-01-26 23:25               ` Katsumi Yamaoka
2015-01-27  2:06               ` Stefan Monnier
2015-01-27  3:16                 ` Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4mbnlmqe1u.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=19613@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.