|
From: | Michael Heerdegen |
Subject: | Re: How do I pass a variable defined in a wrapping let, to a lambda? |
Date: | Sat, 12 Mar 2022 02:37:04 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Hi Eric, you may want to find out what evaluating lexical-binding in the buffer with lexical-binding -> nil gives you. Second: (AFAIK...) be sure to reeval `steinars-test' with lexical-binding -> nil. `steinars-test' defined using the lexical binding dialect will return a closure even when called in the dynamcially binding dialect. Eric Abrahamsen <eric@ericabrahamsen.net> writes: > Oh, maybe I'm wrong. I just tested some code in two different elisp > buffers, one with lexical-binding -> t and one with it nil, and it > worked in both cases. Darn -- I thought I understood lexical-binding. > > (defun steinars-test (file) > (let ((fname (expand-file-name file))) > (lambda () (message "file is %s" fname)))) > > (setq payload (steinars-test "~/.emacs.d/init.el")) > > (funcall payload)
[Prev in Thread] | Current Thread | [Next in Thread] |