all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: 28990@debbugs.gnu.org
Cc: Nicolas Petton <nicolas@petton.fr>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#28990: 27.0.50; thunk-delay: running expansion also requires lexical-binding
Date: Fri, 27 Oct 2017 16:08:12 +0200	[thread overview]
Message-ID: <87efpofzub.fsf@web.de> (raw)
In-Reply-To: <87po9be3um.fsf@web.de> (Michael Heerdegen's message of "Wed, 25 Oct 2017 15:47:45 +0200")

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Fix-bug-28990.patch --]
[-- Type: text/x-diff, Size: 748 bytes --]

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


[-- Attachment #3: Type: text/plain, Size: 131 bytes --]


I would additionally add a sentence to "thunk.el"'s header saying that
creating thunks requires lexical binding.


TIA,

Michael.

  reply	other threads:[~2017-10-27 14:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 13:47 bug#28990: 27.0.50; thunk-delay: running expansion also requires lexical-binding Michael Heerdegen
2017-10-27 14:08 ` Michael Heerdegen [this message]
2017-10-27 16:01   ` Nicolas Petton
2017-11-01 14:08     ` Michael Heerdegen
2017-11-01 14:48       ` Nicolas Petton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efpofzub.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=28990@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=nicolas@petton.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.