From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "andlind@gmail.com" Newsgroups: gmane.emacs.help Subject: Re: Why looking-at-p works? Date: Tue, 15 May 2018 01:34:36 -0700 (PDT) Message-ID: <048df544-2003-4bdf-91ea-8ed78a70dc8b@googlegroups.com> References: <86r2oxsi4o.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1526373215 4369 195.159.176.226 (15 May 2018 08:33:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 May 2018 08:33:35 +0000 (UTC) Injection-Date: Tue, 15 May 2018 08:34:36 +0000 User-Agent: G2/1.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 15 10:33:31 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fIVOj-0000v4-Qn for geh-help-gnu-emacs@m.gmane.org; Tue, 15 May 2018 10:33:29 +0200 Original-Received: from localhost ([::1]:51729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIVQi-0000kB-PP for geh-help-gnu-emacs@m.gmane.org; Tue, 15 May 2018 04:35:32 -0400 X-Received: by 2002:ac8:1bab:: with SMTP id z40-v6mr20204426qtj.12.1526373276791; Tue, 15 May 2018 01:34:36 -0700 (PDT) X-Received: by 2002:a1f:2f8b:: with SMTP id v133-v6mr2309516vkv.10.1526373276608; Tue, 15 May 2018 01:34:36 -0700 (PDT) Original-Path: usenet.stanford.edu!x25-v6no2566821qto.0!news-out.google.com!p41-v6ni625qtp.1!nntp.google.com!x25-v6no2566809qto.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <86r2oxsi4o.fsf@zoho.com> Complaints-To: groups-abuse@google.com Original-Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=90.227.126.54; posting-account=k77ESQoAAABOHZ-xdSiC_Gs4kD0z8QFO Original-NNTP-Posting-Host: 90.227.126.54 Original-Xref: usenet.stanford.edu gnu.emacs.help:222621 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116740 Archived-At: On Tuesday, 6 March 2018 09:50:03 UTC+1, Emanuel Berg wrote: > Do you need dynamic scope for `let' to work > like that? It depends on if the variable has been declared using `defvar' or not. If is has beed declared with `defvar' then `let' will behave in the same wa= y -- it appears as though the global variable is temporary changed in the b= ody and in functions called from the body. In fact, this has been the stand= ard way change a global variable in elisp for many years, and I guess no on= e was prepared to change it. On the other hand, if the variable hasn't been declared then a statically s= coped program will create a true local variable that doesn't affect called = functions, whereas a dynamically scoped program would create a variable tha= t would hide variables with the same name in outer scopes. (Reservation: I = haven't verified this myself.) Personally, I think elisp took a wrong turn when they retrofitted staticall= y scopes to elisp. It would have been better to introduce a new primitive, = say `slet', to create a static binding, regardless if the variable was glob= al or not. -- Anders Ps. If you use the package `lisp-font-lock-extra', variables bound e.g. by = `let' will be highlighted, and the package will highlight local and globall= y declared variables differently. This helps you to avoid accidentally over= writing generically named global variables like `features' and `mode-name'.