[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: let, let*, oh, why [was: Elisp - Function returning a list]
From: |
tomas |
Subject: |
Re: let, let*, oh, why [was: Elisp - Function returning a list] |
Date: |
Wed, 16 Dec 2020 21:34:48 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Dec 16, 2020 at 11:05:36PM +0300, Jean Louis wrote:
> * Stefan Monnier <monnier@iro.umontreal.ca> [2020-12-16 22:05]:
> > >> That doesn't do what you usually want.
> > > Help me to understand why?
> >
> > https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00750.html
>
> Is it possible to show example that it will not work as expected?
Compose a file roughly like this:
(let ((canary 'lexical))
(defun test-binding ()
(insert (format "binding is %S" canary))))
(let ((canary 'dynamic))
(test-binding))
Now save it, say as /tmp/foo.el.
Next, from some buffer (say *scratch*), do M-x load-file <ENTER> /tmp/foo.el
<ENTER>.
This will put in your buffer "binding is dynamic" (since that's the
default).
Now test again
(1) having inserted (setq lexical-binding t) at the top of the above
file
(2) having inserted -*- lexical-binding: t -*- at the top of the
above file.
Compare results. Discuss :-)
(Cheatsheet: in case (1), the variable `lexical-binding' has been set
in the buffer from which you called `load-file', which was, if you
chose the same setting as me, *scratch*. In the second case, the
setting of the lexical binding was effective for the source file
itself, i.e. foo.el)
Cheers
- t
signature.asc
Description: Digital signature
- Re: Elisp - Function returning a list, (continued)
- Re: Elisp - Function returning a list, Joost Kremers, 2020/12/16
- Re: Elisp - Function returning a list, Emanuel Berg, 2020/12/16
- let, let*, oh, why [was: Elisp - Function returning a list], tomas, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Emanuel Berg, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Jean Louis, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Stefan Monnier, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Jean Louis, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Stefan Monnier, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list], tomas, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Jean Louis, 2020/12/16
- Re: let, let*, oh, why [was: Elisp - Function returning a list],
tomas <=
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Emanuel Berg, 2020/12/18
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Emanuel Berg, 2020/12/18
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Jean Louis, 2020/12/18
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Eli Zaretskii, 2020/12/18
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Emanuel Berg, 2020/12/19
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Thien-Thi Nguyen, 2020/12/20
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Emanuel Berg, 2020/12/20
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Thien-Thi Nguyen, 2020/12/20
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Emanuel Berg, 2020/12/20
- Re: let, let*, oh, why [was: Elisp - Function returning a list], Jean Louis, 2020/12/20