[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28990: 27.0.50; thunk-delay: running expansion also requires lexical
From: |
Michael Heerdegen |
Subject: |
bug#28990: 27.0.50; thunk-delay: running expansion also requires lexical-binding |
Date: |
Fri, 27 Oct 2017 16:08:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Michael Heerdegen <michael_heerdegen@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?
>From 45fe6b1bc9573257e59842283fd7da36d760c524 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@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
I would additionally add a sentence to "thunk.el"'s header saying that
creating thunks requires lexical binding.
TIA,
Michael.