GNU bug report logs - #28990
27.0.50; thunk-delay: running expansion also requires lexical-binding

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Wed, 25 Oct 2017 13:49:02 UTC

Severity: minor

Found in version 27.0.50

Done: Michael Heerdegen <michael_heerdegen <at> web.de>

Bug is archived. No further changes may be made.

Full log


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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: 28990 <at> debbugs.gnu.org
Cc: Nicolas Petton <nicolas <at> petton.fr>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#28990: 27.0.50;
 thunk-delay: running expansion also requires lexical-binding
Date: Fri, 27 Oct 2017 16:08:12 +0200
[Message part 1 (text/plain, inline)]
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> #+begin_src emacs-lisp
> (defun my-thunk-test ()
>   (thunk-force (thunk-delay (+ 1 2))))
> #+end_src
>
> This compiles ok, but executing (my-thunk-test) without lexbind enabled
> gives you a meaningless error like "void-variable: forced".

Nicolas, Stefan - ok to fix it like that?

[0001-WIP-Fix-bug-28990.patch (text/x-diff, inline)]
From 45fe6b1bc9573257e59842283fd7da36d760c524 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Thu, 26 Oct 2017 12:57:55 +0200
Subject: [PATCH] WIP: Fix bug#28990

---
 lisp/emacs-lisp/thunk.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el
index bb6d277c27..6dc892c44b 100644
--- a/lisp/emacs-lisp/thunk.el
+++ b/lisp/emacs-lisp/thunk.el
@@ -44,9 +44,12 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl-macs))
+
 (defmacro thunk-delay (&rest body)
   "Delay the evaluation of BODY."
   (declare (debug t))
+  (cl-assert lexical-binding)
   (let ((forced (make-symbol "forced"))
         (val (make-symbol "val")))
     `(let (,forced ,val)
-- 
2.14.2

[Message part 3 (text/plain, inline)]
I would additionally add a sentence to "thunk.el"'s header saying that
creating thunks requires lexical binding.


TIA,

Michael.

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

Previous Next


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