GNU bug report logs - #31792
27.0.50; Regression in #'labels, recent versions

Previous Next

Package: emacs;

Reported by: Aidan Kehoe <kehoea <at> parhasard.net>

Date: Mon, 11 Jun 2018 23:12:01 UTC

Severity: normal

Tags: fixed, patch

Found in versions 27.0.50, 25.3

Fixed in version 26.2

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 31792 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Aidan Kehoe <kehoea <at> parhasard.net>
Cc: 31792 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#31792: 27.0.50; Regression in #'labels, recent versions
Date: Tue, 12 Jun 2018 18:58:29 -0400
[Message part 1 (text/plain, inline)]
tags 31792 + patch
quit

> Seems to have regressed in Emacs 25, cl-labels still works correctly.
> Here's a smaller reproducer:
>
> (labels ((foo () t))
>   #'foo) ;=> foo
>
> (cl-labels ((foo () t))
>   #'foo) ;=> (lambda nil t)

It looks like `labels' missed the update in [1: 69f36afa11], here's a
patch to apply it.  It's not immediately clear to me if the requirement
to use a backquoted lambda vs closure is based on using lexical scoping
where the macro is defined or where it's used, so I left that as is.
Should be fine for emacs-26, I think.

[0001-Fix-fun-handling-inside-labels-Bug-31792.patch (text/x-diff, inline)]
From aa197176d0de4a6b7d1ee5d16d0fc1750f7237cf Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Tue, 12 Jun 2018 18:41:46 -0400
Subject: [PATCH] Fix #'fun handling inside `labels' (Bug#31792)

* lisp/emacs-lisp/cl.el (labels): Apply the equivalent of the
cl-labels change from 2015-01-16 "* lisp/emacs-lisp/cl-macs.el: Fix
last change".
---
 lisp/emacs-lisp/cl.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index d53c8e0bbc..85deb8cb4f 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -466,8 +466,9 @@ labels
 	(push var sets)
 	(push (cons (car binding)
                     `(lambda (&rest cl-labels-args)
-                       (cl-list* 'funcall ',var
-                                 cl-labels-args)))
+                       (if (eq (car cl-labels-args) cl--labels-magic)
+                           (list cl--labels-magic ',var)
+                         (cl-list* 'funcall ',var cl-labels-args))))
               newenv)))
     (macroexpand-all `(lexical-let ,vars (setq ,@sets) ,@body) newenv)))
 
-- 
2.11.0

[Message part 3 (text/plain, inline)]
[1: 69f36afa11]: 2015-01-16 17:49:00 -0500
  * lisp/emacs-lisp/cl-macs.el: Fix last change.
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=69f36afa11c0b754c40f4fc57408ccd85428e2b0

This bug report was last modified 7 years and 30 days ago.

Previous Next


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