From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: Declaring a local dynamic variable? Date: Sun, 13 Oct 2013 19:41:46 +0200 Message-ID: <525ADB5A.8040407@easy-emacs.de> References: <1319c316-9f24-46e1-b774-b7ea11a84ea2@googlegroups.com> <525A55FA.10601@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1381686001 16124 80.91.229.3 (13 Oct 2013 17:40:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Oct 2013 17:40:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 13 19:40:02 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VVPe3-0003ZG-Af for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Oct 2013 19:39:59 +0200 Original-Received: from localhost ([::1]:33993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVPe2-0000ox-Vn for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Oct 2013 13:39:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVPdl-0000of-5n for help-gnu-emacs@gnu.org; Sun, 13 Oct 2013 13:39:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVPdd-0005zC-Sd for help-gnu-emacs@gnu.org; Sun, 13 Oct 2013 13:39:41 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.9]:61136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVPdd-0005yv-Ix for help-gnu-emacs@gnu.org; Sun, 13 Oct 2013 13:39:33 -0400 Original-Received: from purzel.sitgens (brln-4db93dc7.pool.mediaWays.net [77.185.61.199]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MTMxT-1VNPHS08Pv-00Rpkw; Sun, 13 Oct 2013 19:39:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-Provags-ID: V02:K0:aVMFPFMSn6CLSQ25+YVE1CwDL2eQ0oXumuGWNr1uzES aTcWlGsXMsNzLMt7C5sPnq3Wgwuipylueim+DCJa2SFni3+FBQ uT9ZahDNQKUE5caXnroSXGjxV7QCFp/w4FLjXITajp+te8P3mI aZv+U8lDFTQZF/fb06MBzdt3eLbSM4yFGAex9xm6cpkPBgtq1F nPTOC7PVpu17jIyFPrfRz89wWBTBKRPSFYRneF6ahYUCSy8UMy itV1vbge7fhJO75aZil0f674LMAB2pr/Ms0JZRO0JGsHOUQGp0 Xe0dYa0JGPKX7/KM44oflYvFsE0iaA/lOxQhfzgHge35hZqR+c Cw+ZH147Lpr3BKgc6I3CkBkxG+4uX3QQthJxnSVz4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93993 Archived-At: Am 13.10.2013 15:37, schrieb Stefan Monnier: >>> The above code has the same effect as >>> - create global variable x, initialize it to 5 >>> - execute bla bla >>> - change value of x to 6 >> No. Introduces a let-bound x, which is unrelated to global x > > You're confused. Really? So that's what I get: (defvar x 5) x->5 (let ((x 6)) x) ->6 (#o6, #x6, ?\C-f) x->5 GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2013-08-28 [ ... ] > The real story is more complicated because the old value stashed on the > stack includes the information about whether `x' was already defined or > not, Sure it's more complicated. We are taking about the use of symbols at Emacs Lisp level, not about internals. BTW I'm not blaming anybody because something went wrong. Just saying: let's correct it. Best, Andreas and more importantly because variables can be buffer-local, so it > needs also to remember which buffer's value was modified and only restore > `x' for that buffer. > > > Stefan > > >