emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master bbb85ef: * lisp/emacs-lisp/thunk.el: Assert lexical


From: Michael Heerdegen
Subject: [Emacs-diffs] master bbb85ef: * lisp/emacs-lisp/thunk.el: Assert lexical-binding
Date: Wed, 1 Nov 2017 09:43:44 -0400 (EDT)

branch: master
commit bbb85eff4923d33a5271e885faab92d3546db0c0
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    * lisp/emacs-lisp/thunk.el: Assert lexical-binding
    
    This fixes Bug#28990.  Also add a note to the file header that
    creating thunks requires lexical-binding.
    (thunk-delay): `cl-assert' lexical-binding.
---
 lisp/emacs-lisp/thunk.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el
index bb6d277..371d104 100644
--- a/lisp/emacs-lisp/thunk.el
+++ b/lisp/emacs-lisp/thunk.el
@@ -29,9 +29,9 @@
 ;; Thunk provides functions and macros to delay the evaluation of
 ;; forms.
 ;;
-;; Use `thunk-delay' to delay the evaluation of a form, and
-;; `thunk-force' to evaluate it. The result of the evaluation is
-;; cached, and only happens once.
+;; Use `thunk-delay' to delay the evaluation of a form (requires
+;; lexical-binding), and `thunk-force' to evaluate it. The result of
+;; the evaluation is cached, and only happens once.
 ;;
 ;; Here is an example of a form which evaluation is delayed:
 ;;
@@ -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)



reply via email to

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