[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lambda in macrolet becomes a closure? (another breaking change in em
From: |
Michael Heerdegen |
Subject: |
Re: Lambda in macrolet becomes a closure? (another breaking change in emacs:)) |
Date: |
Tue, 27 Sep 2016 16:57:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Constantin Kulikov <address@hidden> writes:
> Also, by looking at `minibuffer-with-setup-hook' [...] There is no
> quotation of the fun, funsym or hook. Is it correct?
A good question. But I think the definition is correct in this regard.
FUN is (bound to) an expression (since `minibuffer-with-setup-hook' is a
macro and FUN is just "pasted" into the expansion without evaluation).
If you look at the expansion (let's use a lambda form as FUN):
#+begin_src emacs-lisp
(macroexpand-1
'(minibuffer-with-setup-hook
(lambda () (do-some-setup)) do-this do-that))
==>
(let
((#2=#:fun
(lambda nil
(do-some-setup)))
#1=#:setup-hook)
(setq #1#
(lambda nil
(remove-hook #3='minibuffer-setup-hook #1#)
(funcall #2#)))
(unwind-protect
(progn
(add-hook #3# #1#)
do-this do-that)
(remove-hook #3# #1#)))
#+end_src
you see that nowhere a function value is evaluated. In some cases, a
function expression is bound to a symbol (`let', `setq'), in the other
cases, the code refers to the binding of these symbols.
Michael.
- Re: Lambda in macrolet becomes a closure? (another breaking change in emacs:)), (continued)