From unknown Fri Aug 15 12:52:17 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#9469 <9469@debbugs.gnu.org> To: bug#9469 <9469@debbugs.gnu.org> Subject: Status: buffer-local variables seem to remember previous values Reply-To: bug#9469 <9469@debbugs.gnu.org> Date: Fri, 15 Aug 2025 19:52:17 +0000 retitle 9469 buffer-local variables seem to remember previous values reassign 9469 emacs submitter 9469 Le Wang severity 9469 normal tag 9469 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 10 13:11:39 2011 Received: (at submit) by debbugs.gnu.org; 10 Sep 2011 17:11:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2R5f-0001pq-8A for submit@debbugs.gnu.org; Sat, 10 Sep 2011 13:11:39 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2R5c-0001pi-CJ for submit@debbugs.gnu.org; Sat, 10 Sep 2011 13:11:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2R1Y-0001Nl-CV for submit@debbugs.gnu.org; Sat, 10 Sep 2011 13:07:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:51528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2R1Y-0001Nh-Az for submit@debbugs.gnu.org; Sat, 10 Sep 2011 13:07:24 -0400 Received: from eggs.gnu.org ([140.186.70.92]:40778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2R1X-0008KE-F5 for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 13:07:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2R1W-0001NP-9a for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 13:07:23 -0400 Received: from mail-qy0-f169.google.com ([209.85.216.169]:40309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2R1W-0001NK-7N for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 13:07:22 -0400 Received: by qyk27 with SMTP id 27so1910322qyk.0 for ; Sat, 10 Sep 2011 10:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=xgWvTUd30JNvJkiYunqkTKjsRoVFrJWBp+saYDUoj/4=; b=NgOWTawwpVu/1Q2K+5MTvwinl8milIQdzt699ODjdnD3ZZgwzDOEbm7HyXi/vQxn5e VI59BS5AesT4+TGbGnXP+KkB2fUIcV99Edk7R9w5C6ldDG+jYRwvunzB7X6LslUCyYKH ojcmicRj02pEE5XRF+4xuOgtHQCpFtSUDN8K8= MIME-Version: 1.0 Received: by 10.224.95.138 with SMTP id d10mr470551qan.227.1315674441541; Sat, 10 Sep 2011 10:07:21 -0700 (PDT) Received: by 10.224.61.1 with HTTP; Sat, 10 Sep 2011 10:07:21 -0700 (PDT) Date: Sun, 11 Sep 2011 01:07:21 +0800 Message-ID: Subject: buffer-local variables seem to remember previous values From: Le Wang To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) I've reproed in both Emacs 23.3 and bzr build from a few days ago both on windows. Steps: 1. emacs -Q 2. eval this region: (setq buf-a (create-file-buffer "a")) (setq foo nil) (make-variable-buffer-local 'foo) (defun test1 () (interactive) (let (alist) (push '(:var . 0) alist) (with-current-buffer buf-a (setq foo alist)))) (defun test2 () (interactive) (with-current-buffer buf-a (setcdr (assq :var foo) 20))) (defun show () (interactive) (with-current-buffer buf-a (format " ; foo in 'a' is %s" foo))) (defun test3 () (interactive) (let (alist) (push `(:var . ,(+ 0)) alist) (with-current-buffer buf-a (setq foo alist)))) (test1) (test2) (test1) (insert (show)) (test3) (insert (show)) Note results on both `insert' lines should be identical but the first insert some how remembers a previous value. I find it surprising that no one has ever come across this before. -- Le From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 10 13:48:39 2011 Received: (at 9469) by debbugs.gnu.org; 10 Sep 2011 17:48:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2RfS-0004iD-Vr for submit@debbugs.gnu.org; Sat, 10 Sep 2011 13:48:39 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2RfQ-0004i6-Uu for 9469@debbugs.gnu.org; Sat, 10 Sep 2011 13:48:37 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8AHiNU7019630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 10 Sep 2011 17:44:25 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8AHiMej007405 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Sep 2011 17:44:22 GMT Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8AHiGRa002713; Sat, 10 Sep 2011 12:44:16 -0500 Received: from dradamslap1 (/10.159.63.205) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 10 Sep 2011 10:44:16 -0700 From: "Drew Adams" To: "'Le Wang'" , <9469@debbugs.gnu.org> References: Subject: RE: bug#9469: buffer-local variables seem to remember previous values Date: Sat, 10 Sep 2011 10:44:19 -0700 Message-ID: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acxv3DY3Ot3Q20JTTm2bIIorMPtRGwAAsQnA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090208.4E6BA1F9.0052:SCFMA922111,ss=1,re=-4.000,fgs=0 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: 9469 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) > 1. emacs -Q > 2. eval this region: > (setq buf-a (create-file-buffer "a")) > (setq foo nil) > (make-variable-buffer-local 'foo) > (defun test1 () > (interactive) > (let (alist) > (push '(:var . 0) alist) > (with-current-buffer buf-a > (setq foo alist)))) > (defun test2 () > (interactive) > (with-current-buffer buf-a > (setcdr (assq :var foo) 20))) > (defun show () > (interactive) > (with-current-buffer buf-a > (format " ; foo in 'a' is %s" foo))) > (defun test3 () > (interactive) > (let (alist) > (push `(:var . ,(+ 0)) alist) > (with-current-buffer buf-a > (setq foo alist)))) > > (test1) > (test2) > (test1) > (insert (show)) > (test3) > (insert (show)) > > Note results on both `insert' lines should be identical but the first > insert some how remembers a previous value. I find it surprising that > no one has ever come across this before. No, they should not be identical. This is a classic Lisp gotcha. (test1) sets buffer-local var `foo' to a new alist ((:var . 0)). (test2) sets the cdr of the single element of that alist to 20. That means that `foo' in buf-a is now ((:var . 20)). (test1) then creates a new alist and pushes the _same_ cons, (:var . 20) onto it. And it sets `foo' to this new alist. If you were to use (cons :var 0) instead of '(:var . 0) then you would not be reusing the same cons cell. Note that different Lisps (and different implementations of the same Lisp) can treat a sexp such as '(a b) differently - they might or might not create a new list each time it is read or eval'd. To be sure to get what you expect in situations like this, do not use '(...). Use `cons' or `list' or equivalent backquote syntax. Do not expect '(...) to create new list structure each time it is read/eval'd. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 13:02:08 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 17:02:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2nQ0-0001EV-Ge for submit@debbugs.gnu.org; Sun, 11 Sep 2011 13:02:08 -0400 Received: from mail-qy0-f179.google.com ([209.85.216.179]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2nPy-0001EO-8O for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 13:02:06 -0400 Received: by qyk33 with SMTP id 33so494650qyk.3 for <9469@debbugs.gnu.org>; Sun, 11 Sep 2011 09:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Cw1Zc07QgTaTeevKgQkWUDBAMDOHSA8761/fRw9i0J8=; b=cPTNZoNvJOTDxppo2158MbOBV3Tn1z5vrX3x/XEGNFas7yunOAQv+f9B6emllJ+EAF GkXYM8GrfUJjf0pkWOJvhtdEDW4zkZsL8CPpvGOhAkdxlqwSECeuI3ejJdXZldanMKK9 0fuTG8QUKXQrgeTqbwYBvb1EaT5p21ETO7Rpo= MIME-Version: 1.0 Received: by 10.224.212.8 with SMTP id gq8mr3004226qab.377.1315760269379; Sun, 11 Sep 2011 09:57:49 -0700 (PDT) Received: by 10.224.61.1 with HTTP; Sun, 11 Sep 2011 09:57:49 -0700 (PDT) In-Reply-To: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> Date: Mon, 12 Sep 2011 00:57:49 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: Drew Adams Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: 9469 Cc: 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) On Sun, Sep 11, 2011 at 1:44 AM, Drew Adams wrote: > No, they should not be identical. =A0This is a classic Lisp gotcha. Thanks for the pointer, Drew. I was unable to google up any information regarding this as being a classic gotcha. Do you have any references? If this is in fact "by design", then the manual should definitely say so in the quoting section. Do I have to follow a different procedure to file a documentation bug? --=20 Le From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 14:00:54 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 18:00:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2oKr-0005n7-Uy for submit@debbugs.gnu.org; Sun, 11 Sep 2011 14:00:54 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2oKp-0005mz-6E for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 14:00:52 -0400 Received: from rtcsinet21.oracle.com (rtcsinet21.oracle.com [66.248.204.29]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8BHuVCq010518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 11 Sep 2011 17:56:33 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rtcsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8BHuUv0019003 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 11 Sep 2011 17:56:31 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8BHuPgI002830; Sun, 11 Sep 2011 12:56:25 -0500 Received: from dradamslap1 (/10.159.62.110) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 11 Sep 2011 10:56:25 -0700 From: "Drew Adams" To: "'Le Wang'" References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> Subject: RE: bug#9469: buffer-local variables seem to remember previous values Date: Sun, 11 Sep 2011 10:56:29 -0700 Message-ID: <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acxwo/PZUIwvfUMzSLyvyv5X+2jP/wAAe2jw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: rtcsinet21.oracle.com [66.248.204.29] X-CT-RefId: str=0001.0A090204.4E6CF651.00D7,ss=1,re=0.000,fgs=0 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: 9469 Cc: 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) > > No, they should not be identical. BTW, I should have said "It is not the case that they should be = identical." Not quite the same thing. There is no "should" here. AFAIK, most Lisps do = not prescribe the behavior in this regard - it is up to the implementation. = But I'm no expert on just what various Lisps define wrt this. > >=A0This is a classic Lisp gotcha. > Thanks for the pointer, Drew. >=20 > I was unable to google up any information regarding this as being a > classic gotcha. Do you have any references? No, I would have to google also. I said it's "classic", which probably = really means that I was bitten by the same gotcha many, many moon ago, and I = learned my lesson then, in discussion with people who knew Lisp well. Well, a quick google of "lisp quote list" brings me to this: http://stackoverflow.com/questions/134887/when-to-use-quote-in-lisp Search that page for "DO NOT USE QUOTE TO CREATE LISTS THAT YOU WILL = LATER MODIFY". It says, "The spec allows the compiler to treat quoted lists = as constants." I guess it might be referring to the Common Lisp spec; = dunno. Scroll down further to the explanation by Matthias Benkard. He points = out that when you use (quote (a b c)) the list (a b c) is created (the first = time) by the Lisp loader or reader, not by `quote'. `quote' just returns that = already existing list. `quote' does not create new list structure (or new = symbols or new strings or...). You can probably find other, similar explanations by googling. The real lesson, I think, is what I said earlier, which works for all = Lisps: Do not expect `quote' to create new list structure. > If this is in fact "by design", then the manual should definitely say > so in the quoting section. Do I have to follow a different procedure > to file a documentation bug? I don't think the Elisp manual should say anything about it, but I'll = let others decide that. The takeaway is, I think, that you should not depend on '(...) to create = new list structure each time it is evaluated. I suppose the manual could = say that. Or it could perhaps clarify that `quote' does not create new Lisp = objects; it just returns the object that is its argument, unevaluated. What can = confuse people is that the object already exists; it is provided by the reader = (or the loader). I guess you could say that the reader treats list notation it encounters similarly to what it does for symbol notation: if a symbol with the = encountered name already exists then it uses ("returns") that symbol. Otherwise, it = first creates a symbol with that name. IOW, the reader `intern's names it = encounters. Similarly, it handles list notation it encounters by either creating a = new list or returning an existing one. Again, I'm no expert on this. Perhaps someone else can explain it = better. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 14:13:05 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 18:13:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2oWe-00064b-MK for submit@debbugs.gnu.org; Sun, 11 Sep 2011 14:13:05 -0400 Received: from mail-out.m-online.net ([212.18.0.9]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2oWc-000647-VV for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 14:13:03 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 5BF291C021C4; Sun, 11 Sep 2011 20:08:44 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.8.164]) by mail.m-online.net (Postfix) with ESMTP id E4A6E1C000AF; Sun, 11 Sep 2011 20:08:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new, port 10024) with ESMTP id CbEN+rzknLFo; Sun, 11 Sep 2011 20:08:44 +0200 (CEST) Received: from igel.home (ppp-88-217-122-177.dynamic.mnet-online.de [88.217.122.177]) by mail.mnet-online.de (Postfix) with ESMTP; Sun, 11 Sep 2011 20:08:44 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 2E21CCA296; Sun, 11 Sep 2011 20:08:44 +0200 (CEST) From: Andreas Schwab To: "Drew Adams" Subject: Re: bug#9469: buffer-local variables seem to remember previous values References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> X-Yow: Now I understand the meaning of ``THE MOD SQUAD''! Date: Sun, 11 Sep 2011 20:08:44 +0200 In-Reply-To: <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> (Drew Adams's message of "Sun, 11 Sep 2011 10:56:29 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9469 Cc: 9469@debbugs.gnu.org, 'Le Wang' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) This has nothing to do with the use of quote, but with the use of destructive functions (setcdr) on a shared data structure. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 14:53:39 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 18:53:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2p9u-0000zu-EN for submit@debbugs.gnu.org; Sun, 11 Sep 2011 14:53:38 -0400 Received: from mail-qy0-f179.google.com ([209.85.216.179]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2p9s-0000zn-Hp for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 14:53:37 -0400 Received: by qyk33 with SMTP id 33so527689qyk.3 for <9469@debbugs.gnu.org>; Sun, 11 Sep 2011 11:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=5IX1ijiT0UOvqoLKmu2olyMdTpkZQvm3P/woQLnReRQ=; b=fyCi58hnnhiJ87FvOk3jHfnAmtlfoaeflL1/iZyxK89YRxccpWUbvWpgArlcrNr27K QJU/aIIpJnP6CZOdfgg9miYbgh+xOROaMM6XVQhmcxggrZTOe3P2vUPY/IRGb92f6Ijf 6IBHuZGiJEgAPVzLSwCAkDl1GMoFDDVpigIAw= MIME-Version: 1.0 Received: by 10.224.95.138 with SMTP id d10mr1132170qan.227.1315766959086; Sun, 11 Sep 2011 11:49:19 -0700 (PDT) Received: by 10.224.61.1 with HTTP; Sun, 11 Sep 2011 11:49:19 -0700 (PDT) In-Reply-To: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Date: Mon, 12 Sep 2011 02:49:19 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: Andreas Schwab Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 9469 Cc: 9469@debbugs.gnu.org, Drew Adams X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) On Mon, Sep 12, 2011 at 2:08 AM, Andreas Schwab wro= te: > This has nothing to do with the use of quote, but with the use of > destructive functions (setcdr) on a shared data structure. Of course you're technically right, but should the manual mention in the "quoting" section that using quote the way I did results in a shared data structure? This part was surprising to me. And I think it will be very surprising to others new to lisp. Specifically, if you read the stackexchange thread Drew pointed to: http://stackoverflow.com/questions/134887/when-to-use-quote-in-lisp It seems I'm not the only one who didn't realize that quote does not cons. > Andreas. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint =3D 58CA 54C7 6D53 942B 1756 =A001D3 44D5 214B 8276 4= ED5 > "And now for something completely different." > --=20 Le From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 15:01:34 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 19:01:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2pHZ-0001we-VE for submit@debbugs.gnu.org; Sun, 11 Sep 2011 15:01:34 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2pHY-0001wX-7o for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 15:01:32 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1R2pDI-0005xD-DX; Sun, 11 Sep 2011 20:57:08 +0200 From: Lars Magne Ingebrigtsen To: Le Wang Subject: Re: bug#9469: buffer-local variables seem to remember previous values In-Reply-To: (Le Wang's message of "Mon, 12 Sep 2011 02:49:19 +0800") Date: Sun, 11 Sep 2011 20:54:04 +0200 Message-ID: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVQRGImGTHLzOX49/10 bYybmbeIp1R+AAACPklEQVQ4jW2SQZKjMAxF5S6xt6vIBUx8Aajs5ZS8pxnp/leZL+juSXUmgTj4 WfpfQrT9+qysFcsn/QYPH4H1Dax3/YNlf49ougD7e8SDodH6G9jqaMu2nmBdXiMOOvB7abyAteqE pckZUV9As1H/B2pT4m27zwHqC2iuclu2Zr8jmjvl52p0guOfs2raP7a75O+Ir6i1iQA8dj41jh8A Ce/Pral8i6/1zPUYg/q8teEXQA/Qhy0WU+Gl6f4T4eef5iZUjiaJQuLsM4579eFSyvOwcoL6Bczd XFL52DPA2iJ98z9bdZTnTDL2gjpWxx42l7W6H74Ll8lMT3BERMX+sIHKy5gSAJ7hCBROdfc996JU Cq0VkktEOAApUYcAFWptGPLDDhoOYaaE4w5X4eRYUcAFPhl5Jg2gw48HAnyI8ugJERoacXZB2FAV AUNADnFMntsBXVwgnwMtKSHTmmr40aFDiLuF+AVMza8AIpolTankFMCvVAqjSVTysDJ3AMg60kGA Ek0qqqlwYvKx4zaRqDpPdFgqibITXgC7AhAJZf1o2m93Rl4zBlCWECGrNnvUjq4oR36OO7G2nlF2 gNNohFKI31SwlXIAp3GVgOryPEsZllA9wRD8oBmMb8LZLCExkXs4hSDkhWZUXeI6CE7Zx51kwvum OCwFJVZowovtp6+Ywpx06pmdYBpb0VjGFGI084Ta506EoYspIHn66S4r3cIupcw28LYx4MRzVsZ8 RoEYFdiV6I1hFjIz8nIufwEjmdFkmASPbwAAAABJRU5ErkJggg== X-Now-Playing: Nadja's _Radiance of Shadows_: "now i am become death the destroyer of worlds" MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1R2pDI-0005xD-DX X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1316372228.71926@1z4U2BPHVdinlG9QW6ejTg X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 9469 Cc: Andreas Schwab , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Le Wang writes: >> This has nothing to do with the use of quote, but with the use of >> destructive functions (setcdr) on a shared data structure. > > Of course you're technically right, but should the manual mention in > the "quoting" section that using quote the way I did results in a > shared data structure? This part was surprising to me. If I read your code correctly, Andreas is correct and precise as usual, if a bit terse. :-) The thing you're seeing has absolutely nothing to do with the use of quote. You're destructively altering a single list and expecting to see the list be different in various buffers. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 15:23:00 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 19:23:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2pcJ-0003B5-Nu for submit@debbugs.gnu.org; Sun, 11 Sep 2011 15:22:59 -0400 Received: from mail-qy0-f179.google.com ([209.85.216.179]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2pcH-0003Ay-Ai for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 15:22:58 -0400 Received: by qyk33 with SMTP id 33so536521qyk.3 for <9469@debbugs.gnu.org>; Sun, 11 Sep 2011 12:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=COa2CjjLumKGvwjjwRZk9Cnp7NOrrkNIzTRY8eii790=; b=q8XVKLYizQIYxmtjLI5gAzvIQg233Ec2dNgYRwW8hCC+3FUuW3MUxv735eaSCnUb2a GsrE/KwxEPXNRPJFPIqm+rxY0Cl1konhu+mREbyNJ4pM1WV6mHUK+rEjzt8irykFd3qX mbrLjk9Hq/Jxh2cd2JaptG3jw5Xrvdaw2jfF0= MIME-Version: 1.0 Received: by 10.224.9.211 with SMTP id m19mr1302024qam.77.1315768719810; Sun, 11 Sep 2011 12:18:39 -0700 (PDT) Received: by 10.224.61.1 with HTTP; Sun, 11 Sep 2011 12:18:39 -0700 (PDT) In-Reply-To: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Date: Mon, 12 Sep 2011 03:18:39 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: Lars Magne Ingebrigtsen Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 9469 Cc: Andreas Schwab , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) On Mon, Sep 12, 2011 at 2:54 AM, Lars Magne Ingebrigtsen wrote: > If I read your code correctly, Andreas is correct and precise as usual, > if a bit terse. :-) Ok, that was my fault. I didn't know how to make heads or tails of the situation, so included some red herrings in my original snippet. This should clarify my exact point of confusion: (setq foo-alist nil) ;; => nil (defun reset-var-in-foo-alist () (push '(:var . 0) foo-alist)) ;; => reset-var-in-foo-alist (defun increment-var-in-foo-alist () (let ((var-cons (assq :var foo-alist))) (setcdr var-cons (1+ (cdr var-cons))))) ;; => increment-var-in-foo-alist (reset-var-in-foo-alist) ;; => ((:var . 0)) (increment-var-in-foo-alist) ;; => 1 (reset-var-in-foo-alist) ;; => ((:var . 1) (:var . 1)) Again, my misunderstanding was that in `reset-var-in-foo-alist' quote does not cons, I assumed it did. -- Le From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 15:42:02 2011 Received: (at submit) by debbugs.gnu.org; 11 Sep 2011 19:42:02 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2puk-0004NX-AS for submit@debbugs.gnu.org; Sun, 11 Sep 2011 15:42:02 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2puh-0004N8-3f for submit@debbugs.gnu.org; Sun, 11 Sep 2011 15:42:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2pqV-000224-MA for submit@debbugs.gnu.org; Sun, 11 Sep 2011 15:37:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:54161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2pqV-00021s-Kc for submit@debbugs.gnu.org; Sun, 11 Sep 2011 15:37:39 -0400 Received: from eggs.gnu.org ([140.186.70.92]:51979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2pqU-0004KZ-PG for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2011 15:37:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2pqT-00021T-TI for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2011 15:37:38 -0400 Received: from lo.gmane.org ([80.91.229.12]:51620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2pqT-00021G-O9 for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2011 15:37:37 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R2pqR-00036E-FH for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2011 21:37:35 +0200 Received: from dial-176163.pool.broadband44.net ([212.46.176.163]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Sep 2011 21:37:35 +0200 Received: from eller.helmut by dial-176163.pool.broadband44.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Sep 2011 21:37:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Helmut Eller Subject: Re: bug#9469: buffer-local variables seem to remember previous values Date: Sun, 11 Sep 2011 21:37:25 +0200 Lines: 37 Message-ID: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dial-176163.pool.broadband44.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:TqFgjr3GEW2B89P4bRkr4YpugxE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.5 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) * Lars Magne Ingebrigtsen [2011-09-11 18:54] writes: > Le Wang writes: > >>> This has nothing to do with the use of quote, but with the use of >>> destructive functions (setcdr) on a shared data structure. >> >> Of course you're technically right, but should the manual mention in >> the "quoting" section that using quote the way I did results in a >> shared data structure? This part was surprising to me. > > If I read your code correctly, Andreas is correct and precise as usual, > if a bit terse. :-) > > The thing you're seeing has absolutely nothing to do with the use of > quote. > > You're destructively altering a single list and expecting to see the > list be different in various buffers. Well, quote is tricky! It wouldn't hurt to point out that modifying a quoted list often means modifying your code. E.g. (defun foo () (let ((list '(1 2 3))) (setcdr list (cddr list)))) (equal (copy-tree (symbol-function 'foo)) (progn (foo) (symbol-function 'foo))) returns nil. I think few beginners will see that using setcdr here not only modifies the value stored in the variable list but also modifies the s-exp stored in 'foo. Helmut From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 15:50:56 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 19:50:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2q3M-0005KC-FA for submit@debbugs.gnu.org; Sun, 11 Sep 2011 15:50:56 -0400 Received: from mail-out.m-online.net ([212.18.0.9]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2q3K-0005K5-OJ for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 15:50:55 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 18B281C021D1; Sun, 11 Sep 2011 21:46:37 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.8.164]) by mail.m-online.net (Postfix) with ESMTP id 103E71C00146; Sun, 11 Sep 2011 21:46:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new, port 10024) with ESMTP id Pdidhn7XChNG; Sun, 11 Sep 2011 21:46:36 +0200 (CEST) Received: from igel.home (ppp-88-217-122-177.dynamic.mnet-online.de [88.217.122.177]) by mail.mnet-online.de (Postfix) with ESMTP; Sun, 11 Sep 2011 21:46:36 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 1D3EDCA296; Sun, 11 Sep 2011 21:46:36 +0200 (CEST) From: Andreas Schwab To: Le Wang Subject: Re: bug#9469: buffer-local variables seem to remember previous values References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> X-Yow: Excuse me, but didn't I tell you there's NO HOPE for the survival of OFFSET PRINTING? Date: Sun, 11 Sep 2011 21:46:35 +0200 In-Reply-To: (Le Wang's message of "Mon, 12 Sep 2011 02:49:19 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9469 Cc: 9469@debbugs.gnu.org, Drew Adams X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Le Wang writes: > It seems I'm not the only one who didn't realize that quote does not cons. -- Special Form: quote object This special form returns OBJECT, without evaluating it. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 16:02:37 2011 Received: (at 9469) by debbugs.gnu.org; 11 Sep 2011 20:02:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2qEe-0006LW-C1 for submit@debbugs.gnu.org; Sun, 11 Sep 2011 16:02:37 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2qEa-0006LD-79 for 9469@debbugs.gnu.org; Sun, 11 Sep 2011 16:02:32 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1R2qAK-0007CR-Ul; Sun, 11 Sep 2011 21:58:08 +0200 From: Lars Magne Ingebrigtsen To: Le Wang Subject: Re: bug#9469: buffer-local variables seem to remember previous values In-Reply-To: (Le Wang's message of "Mon, 12 Sep 2011 03:18:39 +0800") Date: Sun, 11 Sep 2011 21:54:43 +0200 Message-ID: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEWcin5wSjiBZ1wlCwhV Kx/+8+rDt6z14dM6nNDVAAACOklEQVQ4jWXSS2/bMAwAYMZI7WvoCt7V0oL0ukTG7o6FnYcAqq9u gUhXN4Ctvz+SdTZnJRIY4CdSTwgpBdioFlGdAfau8N73cwAIgUALYA1bgRQEwgC6a5VD1RrliuSn xLl/4FybuZZap3sFECC6pjsO3ZlhvkOtnwmc24XnUwjxDgNV7BHRlBDeCCQYwIDWJeoaYINtLvlB QNecNwY2rlX5UsCApSmpE9ZhgwqWAsiHjEERlHlWqjqXggy4MWraNhXRyroaZDyDpgzKmXTO2RIk CDIUcC3vxNnzJxgCpagHnQhBiwtkhqdQsm0CqrSnWgoMT6GUEqAByh4JasOgUPKW+ijXMRgOmgI5 39nG8bpWwAOdtQTiR1hAt9SpIbCSt02dcV4LdJznErsCQ5dqV2BLs4DCB2jOAghG38GtAAnM3q7B ljSJZtD2EWgjfK5gvrvuAZpabgLMfuK3Osi1rCGrJ3qt/O/pBQ5Aj2jIM3RgBO5Bz5A/M4E++C/R p70DrHxPzyI+SNo6UL9e4b0O13V+mrYdgfeXw9Jh+SS/teAYKslA5ueQevpNC9wExvh2zbI4DvE/ yP3lSecvcSxS0gQ/GWgvr4W/FBihmF9S2qzgd/S3YpeGp7lKaW+hIxgZblf/UVSE/SHNBJZhRwu9 xX5TVOnjL/ygo9lNE8FoXqpEFdUnnKZ+LtPk50M2EIzFvFScEgCamNIQx2+UiwQjLbc7TnLaHHNB HucoYJskx/MQA4NNX/Lzu7Z/AG0xBehmUjOkAAAAAElFTkSuQmCC X-Now-Playing: Scout Niblett's _I Am_: "Miss In Love With Her Own Fate" MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1R2qAK-0007CR-Ul X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1316375889.05513@YrHpwq61ii28dcT0f9V3KQ X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 9469 Cc: Andreas Schwab , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Le Wang writes: > Again, my misunderstanding was that in `reset-var-in-foo-alist' quote > does not cons, I assumed it did. Ok. So I'm closing this report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 16:02:30 2011 Received: (at control) by debbugs.gnu.org; 11 Sep 2011 20:02:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2qEY-0006L5-0s for submit@debbugs.gnu.org; Sun, 11 Sep 2011 16:02:30 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2qEU-0006Kv-Et for control@debbugs.gnu.org; Sun, 11 Sep 2011 16:02:27 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1R2qAE-0007C6-H4 for control@debbugs.gnu.org; Sun, 11 Sep 2011 21:58:02 +0200 Date: Sun, 11 Sep 2011 21:55:01 +0200 Message-Id: To: control@debbugs.gnu.org From: Lars Magne Ingebrigtsen Subject: control message for bug #9469 X-MailScanner-ID: 1R2qAE-0007C6-H4 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1316375882.69681@/9JMPRdKmNluPIF5nVoHbg X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) tags 9469 notabug close 9469 From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 00:43:38 2011 Received: (at 9469) by debbugs.gnu.org; 12 Sep 2011 04:43:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2yMr-0002M3-MK for submit@debbugs.gnu.org; Mon, 12 Sep 2011 00:43:38 -0400 Received: from mail-qw0-f47.google.com ([209.85.216.47]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2yMo-0002Lb-Ei for 9469@debbugs.gnu.org; Mon, 12 Sep 2011 00:43:35 -0400 Received: by qwh5 with SMTP id 5so2734742qwh.20 for <9469@debbugs.gnu.org>; Sun, 11 Sep 2011 21:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=LXI91tpgNKZSf9jMs/qDiwureyCqRqydD/5VSzxlp78=; b=BRItUWSkrzDJGpktw7bNRjFJywk3R/BEPzh5E+OgmNKj57yxGAfCbZfBmdh9WcSAcM 2e1/3XjdQUx6paSASxGSJoiuO615FMZciGKNFzfMBleXH6H76WHZBo9x9sFEo7/CcXdZ Igr88/ERl3QFFKGK3MmLWQevybiPGfm6ggUlo= MIME-Version: 1.0 Received: by 10.224.9.211 with SMTP id m19mr1559407qam.77.1315802353679; Sun, 11 Sep 2011 21:39:13 -0700 (PDT) Received: by 10.224.61.1 with HTTP; Sun, 11 Sep 2011 21:39:13 -0700 (PDT) In-Reply-To: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Date: Mon, 12 Sep 2011 12:39:13 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: Lars Magne Ingebrigtsen Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: 9469 Cc: Andreas Schwab , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.1 (----) On Mon, Sep 12, 2011 at 3:54 AM, Lars Magne Ingebrigtsen w= rote: > > Ok. =A0So I'm closing this report. First of all, it's entirely possible that in order to preserve my self perception that "I am smart", my ego won't let me admit that I just wasn't smart enough parse the manual properly. However, I still think it's not spelled out clearly enough. It needs an example to clearly show the trap. "The special form quote returns its single argument, as written, without evaluating it. This provides a way to include constant symbols and lists" Isn't the first sentence misleading? It does not *always* return a single argument as written. It does the first time, and memoizes subsequently. Where is the mention of that? The second sentence clarifies that quote should be used for "constant symbols and lists". Again, pedantically speaking, the information is there. It's just not clear enough to prevent other people falling into this trap in the future. I'm happy to leave this bug closed, or work with someone specifically responsible for the Emacs Lisp Manual to come up with a clear small example. > > -- > (domestic pets only, the antidote for overdose, milk.) > =A0bloggy blog http://lars.ingebrigtsen.no/ > --=20 Le From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 04:01:31 2011 Received: (at 9469) by debbugs.gnu.org; 12 Sep 2011 08:01:31 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R31SM-0000s0-5K for submit@debbugs.gnu.org; Mon, 12 Sep 2011 04:01:31 -0400 Received: from mail-out.m-online.net ([212.18.0.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R31SK-0000rr-6X for 9469@debbugs.gnu.org; Mon, 12 Sep 2011 04:01:29 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 73B4D188A18D; Mon, 12 Sep 2011 09:57:06 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.8.164]) by mail.m-online.net (Postfix) with ESMTP id 619731C00334; Mon, 12 Sep 2011 09:57:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new, port 10024) with ESMTP id HtwR+0icLgiX; Mon, 12 Sep 2011 09:57:06 +0200 (CEST) Received: from hase.home (ppp-88-217-102-104.dynamic.mnet-online.de [88.217.102.104]) by mail.mnet-online.de (Postfix) with ESMTP; Mon, 12 Sep 2011 09:57:05 +0200 (CEST) From: Andreas Schwab To: Le Wang Subject: Re: bug#9469: buffer-local variables seem to remember previous values References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> X-Yow: I once decorated my apartment entirely in ten foot salad forks!! Date: Mon, 12 Sep 2011 09:57:05 +0200 In-Reply-To: (Le Wang's message of "Mon, 12 Sep 2011 12:39:13 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9469 Cc: Lars Magne Ingebrigtsen , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Le Wang writes: > "The special form quote returns its single argument, as written, > without evaluating it. This provides a way to include constant symbols > and lists" > > Isn't the first sentence misleading? It does not *always* return a > single argument as written. It does the first time, and memoizes > subsequently. Where is the mention of that? Since the argument does not change, how is that wrong? Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 04:27:38 2011 Received: (at 9469) by debbugs.gnu.org; 12 Sep 2011 08:27:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R31rd-0002Ee-T8 for submit@debbugs.gnu.org; Mon, 12 Sep 2011 04:27:38 -0400 Received: from mail-qy0-f179.google.com ([209.85.216.179]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R31rc-0002EX-AY for 9469@debbugs.gnu.org; Mon, 12 Sep 2011 04:27:36 -0400 Received: by qyk33 with SMTP id 33so768305qyk.3 for <9469@debbugs.gnu.org>; Mon, 12 Sep 2011 01:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gpJzjgxyE/4OHqOnERXaddc2eafiZ8e5AAZO3JS7mcY=; b=X0dFoOc0Mlpfdzxb6jJBLTToiXusee/ZWIWKsMcENzAOOTl96vl3avdcnAgKaFKAko 1WB/3ChA+qPfNrvnTzu/vuUhzbj1a90NIjeBHRRUAll8NA3tgACeODQvIVFUCm25wunr Z/ztQvVIB9yur7SSgn9xLqeDA1EoF83pIGc88= MIME-Version: 1.0 Received: by 10.224.194.202 with SMTP id dz10mr1800937qab.327.1315815795537; Mon, 12 Sep 2011 01:23:15 -0700 (PDT) Received: by 10.224.61.1 with HTTP; Mon, 12 Sep 2011 01:23:15 -0700 (PDT) In-Reply-To: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Date: Mon, 12 Sep 2011 16:23:15 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: Andreas Schwab Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: 9469 Cc: Lars Magne Ingebrigtsen , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.1 (----) On Mon, Sep 12, 2011 at 3:57 PM, Andreas Schwab wrote: > Since the argument does not change, how is that wrong? Yes, I understand from a functional programming perspective, it's perfectly fine. You're right. but you're still being pedantic. Maybe setcdr the way I did was not very lisp-y. I willingly concede I'm a lisp novice, and I'm used to thinking in a more procedural way. My point is that the manual would be more helpful to someone in my position if it had an example saying don't modify quoted objects, and why. Anyway, if it's the opinion of the maintainers that the manual is fine as it is, it's fine with me. Thanks you for looking into this issue, and working on Emacs! -- Le From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 04:39:48 2011 Received: (at 9469) by debbugs.gnu.org; 12 Sep 2011 08:39:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R323Q-0003HX-EC for submit@debbugs.gnu.org; Mon, 12 Sep 2011 04:39:48 -0400 Received: from mail-out.m-online.net ([212.18.0.9]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R323N-0003HP-VP for 9469@debbugs.gnu.org; Mon, 12 Sep 2011 04:39:47 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id F38961C08CFD; Mon, 12 Sep 2011 10:35:24 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.8.164]) by mail.m-online.net (Postfix) with ESMTP id E6D601C00268; Mon, 12 Sep 2011 10:35:24 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new, port 10024) with ESMTP id XzCDmezEf3fz; Mon, 12 Sep 2011 10:35:24 +0200 (CEST) Received: from hase.home (ppp-88-217-102-104.dynamic.mnet-online.de [88.217.102.104]) by mail.mnet-online.de (Postfix) with ESMTP; Mon, 12 Sep 2011 10:35:23 +0200 (CEST) From: Andreas Schwab To: Le Wang Subject: Re: bug#9469: buffer-local variables seem to remember previous values References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> X-Yow: Send your questions to ``ASK ZIPPY'', Box 40474, San Francisco, CA 94140, USA Date: Mon, 12 Sep 2011 10:35:23 +0200 In-Reply-To: (Le Wang's message of "Mon, 12 Sep 2011 16:23:15 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9469 Cc: Lars Magne Ingebrigtsen , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Le Wang writes: > My point is that the manual would be more helpful to someone in my > position if it had an example saying don't modify quoted objects, and > why. This has nothing at all to do with quoting. Don't use destructive functions if you don't know what you are doing. If you store through a pointer in C you also have to take care of side effects. There is nothing new here. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 10:35:16 2011 Received: (at 9469) by debbugs.gnu.org; 12 Sep 2011 14:35:16 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R37bP-0004xS-7t for submit@debbugs.gnu.org; Mon, 12 Sep 2011 10:35:15 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R37bL-0004xI-O1 for 9469@debbugs.gnu.org; Mon, 12 Sep 2011 10:35:13 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8CEUkVU019556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Sep 2011 14:30:48 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8CEUjNG009818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Sep 2011 14:30:45 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8CEUccE012495; Mon, 12 Sep 2011 09:30:39 -0500 Received: from dradamslap1 (/10.159.35.90) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Sep 2011 07:30:38 -0700 From: "Drew Adams" To: "'Andreas Schwab'" , "'Le Wang'" References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com><95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Subject: RE: bug#9469: buffer-local variables seem to remember previous values Date: Mon, 12 Sep 2011 07:30:24 -0700 Message-ID: <16AB56A492D74B3E9BC8D548CD71C6F3@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcxxJv1XZ8A1tyTaT1uKvkUWL/8RwAAMF2rA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090208.4E6E1799.00D2:SCFMA922111,ss=1,re=-4.000,fgs=0 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: 9469 Cc: 'Lars Magne Ingebrigtsen' , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) > > My point is that the manual would be more helpful to someone in my > > position if it had an example saying don't modify quoted > > objects, and why. > > This has nothing at all to do with quoting. Don't use destructive > functions if you don't know what you are doing. Everything that people have said in the thread is true. That doesn't mean that we can't help users more in this regard. What could perhaps be made clearer in the manual - and perhaps in the Lisp Intro manual (e.g., with pedagogic examples), is the role of the Lisp reader in creating list structure, symbols, etc. It is ignorance of or forgetting about this feature of Lisp that confuses users (esp. newbies) when it comes to `quote' etc. Explanation of Lisp reading is far removed in the manual from the description of `quote' (and they are not directly related, so there is nothing wrong with this). It might help to (a) develop the reader-creates-objects subject in the Lisp Intro manual and (b) put a reminder about this in the section about `quote', with a caveat about modifying etc. In sum, it's not about whether you or the manual or Le is right or wrong. It's about helping users. And yes, this is a potential point of confusion. The consequences of the Lisp reader creating things are not necessarily obvious to newbies. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 11:10:40 2011 Received: (at 9469) by debbugs.gnu.org; 12 Sep 2011 15:10:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R389g-0007LA-7t for submit@debbugs.gnu.org; Mon, 12 Sep 2011 11:10:40 -0400 Received: from mail-yi0-f44.google.com ([209.85.218.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R389d-0007L3-JK for 9469@debbugs.gnu.org; Mon, 12 Sep 2011 11:10:38 -0400 Received: by yie12 with SMTP id 12so1872654yie.3 for <9469@debbugs.gnu.org>; Mon, 12 Sep 2011 08:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=CqR9XgmElBLvh8x34DfJbuUI2Wd3Xm7LFsBZMmtHFDw=; b=CJ1swKoXbZUNMgkBSigZ0Jetq6VuDPvB1mQ54gmiqWMtKdX0+mIzdYT1tHi0qYa19M nPOZe+SA10fEmvcfUiYkTcoK0MckErVMyg8EW3KxcE9troicKzhHiG1eq2MPuJ1DkNAG 3JtX+o9VmkbZhyTh2X7SpaOMHn1J4zMn91wT0= MIME-Version: 1.0 Received: by 10.68.37.98 with SMTP id x2mr4706905pbj.318.1315839974851; Mon, 12 Sep 2011 08:06:14 -0700 (PDT) Received: by 10.68.58.138 with HTTP; Mon, 12 Sep 2011 08:06:14 -0700 (PDT) In-Reply-To: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Date: Mon, 12 Sep 2011 23:06:14 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: Andreas Schwab Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: 9469 Cc: Lars Magne Ingebrigtsen , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.1 (----) On Mon, Sep 12, 2011 at 4:35 PM, Andreas Schwab wro= te: > This has nothing at all to do with quoting. =A0Don't use destructive > functions if you don't know what you are doing. =A0If you store through a > pointer in C you also have to take care of side effects. =A0There is > nothing new here. This discussion has turned in a different direction. I've filed doc bug #9482, with some more details. The maintainers can decide what to do with it. --=20 Le From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 08:59:30 2011 Received: (at 9469) by debbugs.gnu.org; 13 Sep 2011 12:59:31 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3SaI-0003v6-C0 for submit@debbugs.gnu.org; Tue, 13 Sep 2011 08:59:30 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3SaE-0003uy-Tc for 9469@debbugs.gnu.org; Tue, 13 Sep 2011 08:59:28 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EACNSb05FxK3+/2dsb2JhbABCp2d5gVMBAQQBViMFCwsOJhIUGA0kiAq4KIZuBKA3hEQ X-IronPort-AV: E=Sophos;i="4.68,374,1312171200"; d="scan'208";a="136063909" Received: from 69-196-173-254.dsl.teksavvy.com (HELO ceviche.home) ([69.196.173.254]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 13 Sep 2011 08:54:59 -0400 Received: by ceviche.home (Postfix, from userid 20848) id BCEC4660B6; Tue, 13 Sep 2011 08:54:58 -0400 (EDT) From: Stefan Monnier To: Le Wang Subject: Re: bug#9469: buffer-local variables seem to remember previous values Message-ID: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Date: Tue, 13 Sep 2011 08:54:58 -0400 In-Reply-To: (Le Wang's message of "Mon, 12 Sep 2011 12:39:13 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 9469 Cc: Lars Magne Ingebrigtsen , Andreas Schwab , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > "The special form quote returns its single argument, as written, > without evaluating it. This provides a way to include constant symbols > and lists" > Isn't the first sentence misleading? It does not *always* return a > single argument as written. It does the first time, and memoizes > subsequently. Where is the mention of that? There is no memoization: the quote does not *construct* the object, it just returns it. The problem is similar/identical to what happens with immediate strings in C: char *foo (void) { char *res = "toto\n"; res[1]++; return res; } [ modern C tries to fix this problem by the use of "const char*". ] > Again, pedantically speaking, the information is there. It's just not > clear enough to prevent other people falling into this trap in the > future. I'd be happy to try and make it more clear to people who aren't familiar with it (after all, that's the main target audience here), but I'm not sure how. Do you have some suggestion about what text to use to make it clear to you? Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 09:17:18 2011 Received: (at 9469) by debbugs.gnu.org; 13 Sep 2011 13:17:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3SrW-0005tv-7q for submit@debbugs.gnu.org; Tue, 13 Sep 2011 09:17:18 -0400 Received: from mail-qw0-f49.google.com ([209.85.216.49]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3SrU-0005to-Bm for 9469@debbugs.gnu.org; Tue, 13 Sep 2011 09:17:17 -0400 Received: by qwm25 with SMTP id 25so612164qwm.22 for <9469@debbugs.gnu.org>; Tue, 13 Sep 2011 06:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OnmESgIR+usv2x7MsUsEr028mbwTjwmPbAKJ0p/HyEg=; b=MflVnJkKaQrqVH2i7R4mWs2zJy1/zxQcelB3AvpPHHE7Bf5kqEYojOMh7GkvcvwhyQ jot/PeW0EEWhYnPeVlWzqpHLG2N0irXm6ryG9++IvR1dIc4qQVypClc3IRJUrLl0oOU0 ITYqnGncKCWlFZF2HM7D55lMqBZsNxQEGMAiw= MIME-Version: 1.0 Received: by 10.224.188.7 with SMTP id cy7mr432431qab.327.1315919568761; Tue, 13 Sep 2011 06:12:48 -0700 (PDT) Received: by 10.224.6.72 with HTTP; Tue, 13 Sep 2011 06:12:48 -0700 (PDT) In-Reply-To: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Date: Tue, 13 Sep 2011 21:12:48 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: Stefan Monnier Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: 9469 Cc: Lars Magne Ingebrigtsen , Andreas Schwab , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.1 (----) On Tue, Sep 13, 2011 at 8:54 PM, Stefan Monnier wrote: > Do you have some suggestion about what text to use to make it clear to you? I filed documentation bug 9482, I I will suggest specific text there. -- Le From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 11:05:43 2011 Received: (at submit) by debbugs.gnu.org; 13 Sep 2011 15:05:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3UYR-0005ZG-I1 for submit@debbugs.gnu.org; Tue, 13 Sep 2011 11:05:43 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3UYP-0005Z8-CY for submit@debbugs.gnu.org; Tue, 13 Sep 2011 11:05:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3UU4-0003Px-T6 for submit@debbugs.gnu.org; Tue, 13 Sep 2011 11:01:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:34575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3UU4-0003Ps-R8 for submit@debbugs.gnu.org; Tue, 13 Sep 2011 11:01:12 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3UU3-0007mJ-Tu for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 11:01:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3UU2-0003PJ-9y for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 11:01:11 -0400 Received: from lo.gmane.org ([80.91.229.12]:40971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3UU2-0003P9-4v for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 11:01:10 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R3UU0-00041u-6J for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 17:01:08 +0200 Received: from dial-176163.pool.broadband44.net ([212.46.176.163]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Sep 2011 17:01:08 +0200 Received: from eller.helmut by dial-176163.pool.broadband44.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Sep 2011 17:01:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Helmut Eller Subject: Re: bug#9469: buffer-local variables seem to remember previous values Date: Tue, 13 Sep 2011 17:00:57 +0200 Lines: 13 Message-ID: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dial-176163.pool.broadband44.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:yQmekcQEMVlOaTwP7Rpm5EWifdE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.5 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) * Stefan Monnier [2011-09-13 12:54] writes: > I'd be happy to try and make it more clear to people who aren't familiar > with it (after all, that's the main target audience here), but I'm not > sure how. I think a section "Lisp pitfalls" in the manual would be about right for this. That could contain examples and explanations like modifying quoted lists or using #'delete without storing the result with setq and other such misunderstandings. Then add references from the description for quote to the pitfalls section. Helmut From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 14:06:54 2011 Received: (at 9469) by debbugs.gnu.org; 13 Sep 2011 18:06:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3XNl-0002Gv-QE for submit@debbugs.gnu.org; Tue, 13 Sep 2011 14:06:54 -0400 Received: from smtprelay-b22.telenor.se ([195.54.99.213]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3XNj-0002Gn-83 for 9469@debbugs.gnu.org; Tue, 13 Sep 2011 14:06:52 -0400 Received: from ipb4.telenor.se (ipb4.telenor.se [195.54.127.167]) by smtprelay-b22.telenor.se (Postfix) with ESMTP id 424E7EA513 for <9469@debbugs.gnu.org>; Tue, 13 Sep 2011 20:02:22 +0200 (CEST) X-SMTPAUTH-B2: [bocjoh] X-SENDER-IP: [85.228.206.69] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj5hAPeZb05V5M5FPGdsb2JhbABBAYkbnlQLAQEBATczgVMBAQVWIxALIRACEw8BBBgBDAoaE4d5t1eDdgGCdwSkYQ X-IronPort-AV: E=Sophos;i="4.68,375,1312149600"; d="scan'208";a="1759120016" Received: from c-45cee455.04-211-6c6b701.cust.bredbandsbolaget.se (HELO muon.localdomain) ([85.228.206.69]) by ipb4.telenor.se with ESMTP; 13 Sep 2011 20:02:21 +0200 Received: by muon.localdomain (Postfix, from userid 1000) id 2F22648458B; Tue, 13 Sep 2011 20:02:20 +0200 (CEST) From: =?utf-8?Q?Johan_Bockg=C3=A5rd?= To: Stefan Monnier Subject: Re: bug#9469: buffer-local variables seem to remember previous values In-Reply-To: (Stefan Monnier's message of "Tue, 13 Sep 2011 08:54:58 -0400") References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Mail-Copies-To: never Date: Tue, 13 Sep 2011 20:02:20 +0200 Message-ID: <87ehzktj6b.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 9469 Cc: Lars Magne Ingebrigtsen , Andreas Schwab , 9469@debbugs.gnu.org, Le Wang X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) Stefan Monnier writes: >> "The special form quote returns its single argument, as written, >> without evaluating it. This provides a way to include constant symbols >> and lists" > >> Isn't the first sentence misleading? It does not *always* return a >> single argument as written. It does the first time, and memoizes >> subsequently. Where is the mention of that? > > There is no memoization: the quote does not *construct* the object, it > just returns it. I think the "as written" bit is mildly confusing, and nearly falls into this trap: In other languages, an expression is text; it has no other form. In Lisp, an expression is primarily a Lisp object and only secondarily the text that is the object's read syntax. Often there is no need to emphasize this distinction, but you must keep it in the back of your mind, or you will occasionally be very confused. -- (info "(elisp) Printed Representation") From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 14:57:28 2011 Received: (at 9469) by debbugs.gnu.org; 13 Sep 2011 18:57:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3YAh-0005ng-Tm for submit@debbugs.gnu.org; Tue, 13 Sep 2011 14:57:28 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3YAe-0005nX-RA for 9469@debbugs.gnu.org; Tue, 13 Sep 2011 14:57:26 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8DIqr5i019744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Sep 2011 18:52:54 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8DIqoUv017108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 13 Sep 2011 18:52:50 GMT Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8DIqib1029141; Tue, 13 Sep 2011 13:52:44 -0500 Received: from dradamslap1 (/10.159.52.70) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Sep 2011 11:52:43 -0700 From: "Drew Adams" To: "=?iso-8859-1?Q?'Johan_Bockg=E5rd'?=" , "'Stefan Monnier'" References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com><95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> <87ehzktj6b.fsf@gnu.org> Subject: RE: bug#9469: buffer-local variables seem to remember previous values Date: Tue, 13 Sep 2011 11:52:42 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87ehzktj6b.fsf@gnu.org> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 Thread-Index: AcxyP11BPe16ZzJmSY6MXMqneenxNwAAGdew X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090206.4E6FA687.0110:SCFMA922111,ss=1,re=-4.000,fgs=0 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: 9469 Cc: 'Lars Magne Ingebrigtsen' , 'Andreas Schwab' , 9469@debbugs.gnu.org, 'Le Wang' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) > I think the "as written" bit is mildly confusing, and nearly > falls into this trap: > > In other languages, an expression is text; it has no > other form. In Lisp, an expression is primarily a Lisp > object Indeed. And I repeat that the misunderstanding comes from not knowing or not sufficiently appreciating where those objects come from: what creates them. That is what it would help to repeat/emphasize in the doc (e.g., in the context of things like `quote', at least via a cross-reference). Users need of course to understand that `quote' just returns its argument, but that is not really the problem here, since they can misunderstand "its argument" per the confusion that Johan referred to (text vs Lisp object). What users might not get is that the argument that `quote' receives is a Lisp object that has already been created. That might not be obvious to someone new to Lisp. Especially when written as ', it is easy to misunderstand `quote' as applying to the textual sexp that follows it, and not to a Lisp object. The Lisp reader is kind of in the background of user awareness, so the question of where the Lisp object comes from can mistakenly be answered by thinking that it is `quote' that creates it based on the text/sexp that follows the '. That, I think, is the gotcha that tripped up Le (and he's not alone). In the case of a literal list argument to `quote', e.g. (quote (a b c)), users need to understand that the Lisp reader (or loader) creates the list (a b c). Given that understanding, what can also be missing is that, depending on the Lisp, the Lisp reader might not create a _new_ list each time it encounters the sexp "(a b c)". And in Emacs Lisp it in fact does not create a new list; it reuses a previously created list, if available. (Is that always true for Elisp? What about gc?). This too is not obvious. And we can point out that literal strings are treated differently - the reader does create a new, `eq'-unique string each time it sees "abc". The bottom line is that we should communicate the lesson that you should not depend on the Lisp reader creating a new object each time it reads a sexp. It would be helpful to mention this and explain that the reader's treatment of list sexps is similar to its treatment of symbol sexps (names). The treatment of symbols is perhaps a bit easier to understand because we introduce the notion of obarray, and because a symbol itself has an explicit string representation (its name). At a minimum, then, the manual's treatment of `quote' (and perhaps other things) should reference some doc that explains the Lisp reader behavior well. From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 16:47:20 2011 Received: (at submit) by debbugs.gnu.org; 13 Sep 2011 20:47:20 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3Zt2-0006Dk-7n for submit@debbugs.gnu.org; Tue, 13 Sep 2011 16:47:20 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3Zsy-0006Db-3U for submit@debbugs.gnu.org; Tue, 13 Sep 2011 16:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3Zob-00053E-NW for submit@debbugs.gnu.org; Tue, 13 Sep 2011 16:42:46 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:42841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3Zob-000539-Ky for submit@debbugs.gnu.org; Tue, 13 Sep 2011 16:42:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]:53308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3Zoa-0007rt-GT for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 16:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3ZoZ-00052c-3r for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 16:42:44 -0400 Received: from lo.gmane.org ([80.91.229.12]:59830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3ZoY-00052S-RM for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 16:42:43 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R3ZoV-00051T-00 for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 22:42:39 +0200 Received: from dial-176163.pool.broadband44.net ([212.46.176.163]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Sep 2011 22:42:38 +0200 Received: from eller.helmut by dial-176163.pool.broadband44.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Sep 2011 22:42:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Helmut Eller Subject: Re: bug#9469: buffer-local variables seem to remember previous values Date: Tue, 13 Sep 2011 22:42:34 +0200 Lines: 40 Message-ID: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> <87ehzktj6b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dial-176163.pool.broadband44.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:2o2ibv2utTXMAgnqZrEk9j+qbes= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.5 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) * Drew Adams [2011-09-13 18:52] writes: [...] > The Lisp reader is kind of in the background of user awareness, so the > question of where the Lisp object comes from can mistakenly be > answered by thinking that it is `quote' that creates it based on the > text/sexp that follows the '. That, I think, is the gotcha that > tripped up Le (and he's not alone). Yes, that's crucial. Beginners need to understand that read and eval are separate and what the purpose of each is: read turns text into s-expressions. eval "executes" s-expressions; eval is described in terms of s-expressions and not text. Also that the reader is not the only way to construct s-expressions for eval. [...] > Given that understanding, what can also be missing is that, depending > on the Lisp, the Lisp reader might not create a _new_ list each time > it encounters the sexp "(a b c)". And in Emacs Lisp it in fact does > not create a new list; it reuses a previously created list, if > available. (Is that always true for Elisp? What about gc?). I've never heard of a reader that does what you describe here. The reader creates a new list for "'foo" just as for "(quote foo)" or for "(bar foo)". (eq (read "'a") (read "'a")) returns nil; all the time. Just like (let ((sexp (read "('a 'a)"))) (eq (car sexp) (cadr sexp))) is always nil. The reader interns symbols but lists and vectors are freshly created (ignoring the #1# syntax for now). The compiler may coalesce constant lists that are equal; but don't let us confuse the reader with the compiler. Helmut From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 15 14:19:17 2011 Received: (at 9469) by debbugs.gnu.org; 15 Sep 2011 18:19:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4GWr-0001ag-QB for submit@debbugs.gnu.org; Thu, 15 Sep 2011 14:19:17 -0400 Received: from mail-qy0-f179.google.com ([209.85.216.179]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4GWo-0001aX-Q8 for 9469@debbugs.gnu.org; Thu, 15 Sep 2011 14:19:16 -0400 Received: by qyk33 with SMTP id 33so3062823qyk.3 for <9469@debbugs.gnu.org>; Thu, 15 Sep 2011 11:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=DJS69x9nHMwQH43mxXaO2xwo4JMF3xtEboLO8w0HkkE=; b=nhcW6z96L4bgYgVHTPDJMowkBNIPm9dbPA9ZoE2gqX7IOtfTY/zmRJ7Ia1ooIPnVGY tXnS/yE/dBr4L9KxHPmZP30uhxk5khe1uopubYBlZ3q+lQUejioLm/++GNDCZaSqYn9i mWY86R1h8oF5wiTN4u66485UYbJRBhccrA810= MIME-Version: 1.0 Received: by 10.224.214.5 with SMTP id gy5mr1248275qab.127.1316110474618; Thu, 15 Sep 2011 11:14:34 -0700 (PDT) Received: by 10.224.6.72 with HTTP; Thu, 15 Sep 2011 11:14:34 -0700 (PDT) In-Reply-To: <87ehzktj6b.fsf@gnu.org> References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com> <95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> <87ehzktj6b.fsf@gnu.org> Date: Fri, 16 Sep 2011 02:14:34 +0800 Message-ID: Subject: Re: bug#9469: buffer-local variables seem to remember previous values From: Le Wang To: =?ISO-8859-1?Q?Johan_Bockg=E5rd?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: 9469 Cc: Drew Adams , Lars Magne Ingebrigtsen , Andreas Schwab , Stefan Monnier , 9469@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.0 (----) On Wed, Sep 14, 2011 at 2:02 AM, Johan Bockg=E5rd wrote: > Stefan Monnier writes: >> There is no memoization: the quote does not *construct* the object, it >> just returns it. > > I think the "as written" bit is mildly confusing, and nearly falls into > this trap: > > =A0 =A0In other languages, an expression is text; it has no other form. I= n > =A0 =A0Lisp, an expression is primarily a Lisp object and only secondaril= y > =A0 =A0the text that is the object's read syntax. Often there is no need = to > =A0 =A0emphasize this distinction, but you must keep it in the back of yo= ur > =A0 =A0mind, or you will occasionally be very confused. > > =A0 =A0 =A0 =A0-- (info "(elisp) Printed Representation") This is kind of funny. Stefan and Andreas basically kept saying quote just returns the thing, but doesn't construct it. My mind couldn't grasp what that means. The reader is the chasm that I just couldn't cross. In my mind a program describes how something happens, it isn't the thing that happens. "(quote (a b))", `quote' is a function that returns a reference to something. And for it to return the same reference, then it must be memoizing based on the inputs. The passage Johan posted along with Drew's explanation has enlightened me. Thank you all. --=20 Le From unknown Fri Aug 15 12:52:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 14 Oct 2011 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator