diff options
| author | Michael Heerdegen | 2017-10-26 12:57:55 +0200 |
|---|---|---|
| committer | Michael Heerdegen | 2017-11-01 14:43:19 +0100 |
| commit | bbb85eff4923d33a5271e885faab92d3546db0c0 (patch) | |
| tree | b11aa99be33e26838abac9b5c53b05524d54840d | |
| parent | 934a72c7e4a506a36697fdb98f837cea989e70e1 (diff) | |
| download | emacs-bbb85eff4923d33a5271e885faab92d3546db0c0.tar.gz emacs-bbb85eff4923d33a5271e885faab92d3546db0c0.zip | |
* 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.
| -rw-r--r-- | lisp/emacs-lisp/thunk.el | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el index bb6d277c270..371d10444b2 100644 --- a/lisp/emacs-lisp/thunk.el +++ b/lisp/emacs-lisp/thunk.el | |||
| @@ -29,9 +29,9 @@ | |||
| 29 | ;; Thunk provides functions and macros to delay the evaluation of | 29 | ;; Thunk provides functions and macros to delay the evaluation of |
| 30 | ;; forms. | 30 | ;; forms. |
| 31 | ;; | 31 | ;; |
| 32 | ;; Use `thunk-delay' to delay the evaluation of a form, and | 32 | ;; Use `thunk-delay' to delay the evaluation of a form (requires |
| 33 | ;; `thunk-force' to evaluate it. The result of the evaluation is | 33 | ;; lexical-binding), and `thunk-force' to evaluate it. The result of |
| 34 | ;; cached, and only happens once. | 34 | ;; the evaluation is cached, and only happens once. |
| 35 | ;; | 35 | ;; |
| 36 | ;; Here is an example of a form which evaluation is delayed: | 36 | ;; Here is an example of a form which evaluation is delayed: |
| 37 | ;; | 37 | ;; |
| @@ -44,9 +44,12 @@ | |||
| 44 | 44 | ||
| 45 | ;;; Code: | 45 | ;;; Code: |
| 46 | 46 | ||
| 47 | (eval-when-compile (require 'cl-macs)) | ||
| 48 | |||
| 47 | (defmacro thunk-delay (&rest body) | 49 | (defmacro thunk-delay (&rest body) |
| 48 | "Delay the evaluation of BODY." | 50 | "Delay the evaluation of BODY." |
| 49 | (declare (debug t)) | 51 | (declare (debug t)) |
| 52 | (cl-assert lexical-binding) | ||
| 50 | (let ((forced (make-symbol "forced")) | 53 | (let ((forced (make-symbol "forced")) |
| 51 | (val (make-symbol "val"))) | 54 | (val (make-symbol "val"))) |
| 52 | `(let (,forced ,val) | 55 | `(let (,forced ,val) |