From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: let vs. buffer local bindings Date: 11 May 2002 00:14:44 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <5xlmard50r.fsf@kfs2.cua.dk> References: <5xy9esxewc.fsf@kfs2.cua.dk> <200205101915.g4AJFSk21990@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1021065310 1381 127.0.0.1 (10 May 2002 21:15:10 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 10 May 2002 21:15:10 +0000 (UTC) Cc: emacs-devel@gnu.org, Dave Pearson , Gareth Owen Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 176HjK-0000MA-00 for ; Fri, 10 May 2002 23:15:10 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 176Hsa-0004Cb-00 for ; Fri, 10 May 2002 23:24:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 176HjM-0005BV-00; Fri, 10 May 2002 17:15:12 -0400 Original-Received: from fepz.post.tele.dk ([195.41.46.133]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 176HiC-000564-00 for ; Fri, 10 May 2002 17:14:00 -0400 Original-Received: from kfs2.cua.dk.cua.dk ([80.62.38.68]) by fepZ.post.tele.dk (InterMail vM.4.01.03.23 201-229-121-123-20010418) with SMTP id <20020510211359.GEQP26021.fepZ.post.tele.dk@kfs2.cua.dk.cua.dk>; Fri, 10 May 2002 23:13:59 +0200 Original-To: "Stefan Monnier" In-Reply-To: <200205101915.g4AJFSk21990@rum.cs.yale.edu> Original-Lines: 54 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3820 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3820 "Stefan Monnier" writes: > > Gareth Owen has found a peculiar > > interference between let and buffer local bindings. > > Gerd has fixed one of the bad interactions between buffer-local and let-bound > variables, but we can't fix them all. Or at least, I think that fixing > them such that there's a clear semantics will mean changing the current > semantics in a way that would break compatibility. Thanks Stefan. I understand what's going on now. Considering that Gerd's fix has indeed improved emacs's behaviour in this area, I think we need to change the elisp manual to reflect this. Specifically, the following warning: *Warning:* When a variable has buffer-local values in one or more buffers, you can get Emacs very confused by binding the variable with `let', changing to a different current buffer in which a different binding is in effect, and then exiting the `let'. This can scramble the values of the buffer-local and default bindings. should be reworded into something less dramatic, e.g. *Warning:* When a variable has buffer-local values in one or more buffers, binding the variable with `let' and changing to a different current buffer in which a different binding is in effect, and then exiting the `let', the variable may not be restored to the value it had before the let. Also, the example illustrating this is no longer valid, as the value of foo is correct when we return to buffer "a", ie. the example should read: (setq foo 'b) (set-buffer "a") (make-local-variable 'foo) (setq foo 'a) (let ((foo 'temp)) ;; foo => 'temp ; let binding in buffer "a" (set-buffer "b") ;; foo => 'b ; the global value since foo is not local in "b" BODY...) foo => 'b ; we are still in buffer "b", but exiting the let ; restored the local value in buffer "a" (set-buffer "a") ; which can be seen here: foo => 'a ; we are back to the local value in buffer "a" -- Kim F. Storm http://www.cua.dk