help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Understanding the "let" construct and the setting of variables


From: steve-humphreys
Subject: Re: Understanding the "let" construct and the setting of variables
Date: Thu, 17 Dec 2020 09:43:30 +0100


> Sent: Thursday, December 17, 2020 at 9:10 AM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: steve-humphreys@gmx.com
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Understanding the "let" construct and the setting of variables
>
>
> On Thu, Dec 17 2020, steve-humphreys@gmx.com wrote:
> > Finally I got some useful information (ielm).  Fantastic.
> >
> > ACCEPTED: Running function has created a global variable `tim` (plus all 
> > the other
> > variables you've setq'ed), and since there are no packages or namespaces in
> > Elisp, your variable is now available to all of Emacs.
> >
> > QUESTION: What happens if one does a "setq" on a variable defined in the 
> > binding part of the
> > "let"? Can one do that?
>
> Yes, inside the body of the `let`, you can.
>
> > QUESTION: What goes in the body of a "let"?  I would think I can use the 
> > variables defined within
> > the binding section of "let".
>
> Yes.
>
> > QUESTION: Can one update a variable in the body of the "let" (the variable 
> > being defined within
> > the binding section of "let").
>
> Yes, with `setq`.

My mistake was that I was trying the variables using (myvar value) in the body 
of "let", the
same way I was doing in the binding part.  That was what confused me when 
others iterated that
"setq" makes the variables available ta all of emacs.

This gets me to "defvar".  I have read that "setq" does net actually
make a variable.  It is defvar that makes a variable available.
When reading the "Intro to Emacs Lisp", the focus is on using "setq".

Do the question really is this.  What happens when one sets an object with 
"setq"
if elisp does not make a variable from the name?


> --
> Joost Kremers
> Life has its moments
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]