diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index df8fa2f8e7..bf0ccaa301 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -3731,6 +3731,24 @@ Sample let Expression value of the variable @code{tiger} is printed at the location of the second @samp{%s}. +@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: + +@smallexample +(setq system-time-locale "C") ;; this modifies system-time-locale system-wide +(let ((system-time-locale "es_ES.UTF8")) ;; change it in the scope of let + (message "(inside let) Hoy es %s" (format-time-string "%d de %B de %Y"))) +(message "(outside) Today is %s" (format-time-string "%d %B %Y")) ;; Restore locale set before +@end smallexample + +Will produce +@smallexample +(inside let) Hoy es 04 de octubre de 2022 +(outside) Today is 04 October 2022 +@end smallexample + @node Uninitialized let Variables @subsection Uninitialized Variables in a @code{let} Statement @cindex Uninitialized @code{let} variables