On Tue, Oct 04, 2022 at 08:46:02AM +0200, Pedro Andres Aranda Gutierrez wrote: > Hi > > this is a small patch for the 'Introduction to Emacs LISP programming' > guide to show how let works on system-wide variables. > Understanding this would have made my life easier the past +20 years ;-) > and an example is sometimes worth 100 lines of explanation (more so if you > are in a hurry and you do diagonal reading) > > Best, /PA [...] > +@need 1500 > +When you use a system-wide variable in @code{let}, its value is modified in its > +scope and then restored. As an example, the following snippet manipulates > +@code{system-time-locale} in the scope of the @code{let} only: > + I think this is technically wrong and potentially confusing. I'd tend to say that a new binding is created which shadows the global binding. The `system-time-locale' in your let-bound scope is a different variable from the global one, although it has the same name. More importantly, nothing gets "restored": it's just the compiler which sees a different variable depending on scope. This is even "more true" (I know, I know) with lexical variables. The example itself seems to me a good idea. Just the mental model needs fixing :) Cheers -- t