From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: frame-local variables weirdness Date: Thu, 11 Oct 2007 10:21:19 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1192112519 5536 80.91.229.12 (11 Oct 2007 14:21:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 11 Oct 2007 14:21:59 +0000 (UTC) Cc: Emacs Devel To: "Juanma Barranquero" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 11 16:21:56 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IfyvA-000410-Jh for ged-emacs-devel@m.gmane.org; Thu, 11 Oct 2007 16:21:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ifyv4-0000pa-Cv for ged-emacs-devel@m.gmane.org; Thu, 11 Oct 2007 10:21:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ifyv1-0000pU-GY for emacs-devel@gnu.org; Thu, 11 Oct 2007 10:21:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ifyuw-0000nd-UR for emacs-devel@gnu.org; Thu, 11 Oct 2007 10:21:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ifyuw-0000na-Q6 for emacs-devel@gnu.org; Thu, 11 Oct 2007 10:21:38 -0400 Original-Received: from x-132-204-254-24.xtpr.umontreal.ca ([132.204.254.24] helo=ceviche.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ifyuq-00084v-VT for emacs-devel@gnu.org; Thu, 11 Oct 2007 10:21:38 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 72FBFB41BB; Thu, 11 Oct 2007 10:21:19 -0400 (EDT) In-Reply-To: (Juanma Barranquero's message of "Thu\, 11 Oct 2007 11\:42\:44 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:80613 Archived-At: > Another bug report from the pre-22.1 past. > This one is an interaction between frame-local and buffer-local variables. > (defun test (sym bug) > ;; Default (global) value for the symbol > (set sym 'default) > (make-variable-frame-local sym) > ;; Frame-local value > (modify-frame-parameters nil (list (cons sym 'frame))) > (when bug > ;; Getting the value of sym changes the result > (symbol-value sym)) > ;; Buffer-local value > (make-variable-buffer-local sym) > (set sym 'local) > ;; Now let's get back the local values > (list (local-variable-p sym) ;; should be t > (symbol-value sym) ;; should be 'local > (frame-parameter nil sym))) ;; should be 'frame > Note that passing t to the BUG argument only changes one thing: that > (symbol-value sym) is run. > (test 'foo nil) => (t local frame) ;; correct > (test 'bar t) => (nil local local) ;; incorrect > Richard proposed the attached patch, with fixes the test case but > causes other problems. I'd much rather disallow variables that are both buffer-local and frame-local. What is the use-case? Stefan > Index: src/data.c > =================================================================== > RCS file: /sources/emacs/emacs/src/data.c,v > retrieving revision 1.278 > diff -u -2 -r1.278 data.c > --- src/data.c 10 Sep 2007 09:41:44 -0000 1.278 > +++ src/data.c 11 Oct 2007 09:30:16 -0000 > @@ -1238,7 +1238,8 @@ > || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame > && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)) > + /* After make-variable-buffer-local, if we haven't got a > + buffer-local binding in place, we need to make one. */ > || (BUFFER_LOCAL_VALUEP (valcontents) > - && EQ (XCAR (current_alist_element), > - current_alist_element))) > + && ! XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer)) > { > /* The currently loaded binding is not necessarily valid. > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel