From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Re: frame-local variables weirdness Date: Thu, 11 Oct 2007 11:42:44 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1192095784 10149 80.91.229.12 (11 Oct 2007 09:43:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 11 Oct 2007 09:43:04 +0000 (UTC) To: "Emacs Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 11 11:43:03 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 1IfuZE-0004IS-4l for ged-emacs-devel@m.gmane.org; Thu, 11 Oct 2007 11:42:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IfuZ8-0006i1-9H for ged-emacs-devel@m.gmane.org; Thu, 11 Oct 2007 05:42:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IfuZ4-0006hJ-SK for emacs-devel@gnu.org; Thu, 11 Oct 2007 05:42:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IfuZ3-0006gr-DB for emacs-devel@gnu.org; Thu, 11 Oct 2007 05:42:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IfuZ3-0006go-7a for emacs-devel@gnu.org; Thu, 11 Oct 2007 05:42:45 -0400 Original-Received: from wx-out-0506.google.com ([66.249.82.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IfuZ2-0000QO-RN for emacs-devel@gnu.org; Thu, 11 Oct 2007 05:42:44 -0400 Original-Received: by wx-out-0506.google.com with SMTP id s7so447029wxc for ; Thu, 11 Oct 2007 02:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=GC1y+C6JE1gvQpVyjS/OpWbzHN55Wbs0LCPusS+wErI=; b=cP6fqLoo25/9hMEF0gtl0iDEciUPPitQPO5FevJLb4bIPaQZaN+QC2IKxOLx6i+eYH9gyQdAEvt1YwssFiCIvr+mGGlOToyHHVQilTHDOjbY9wKHz8dpykaJiwLKy7ds9x4B8rzZbnGU0TRn0ueA9O0cF7+Kf1Pil8e3acTX8hw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ckWxBWqywoyB8LBUSYIUwwLS7RvqJNvSbWery8DODYi+18LmtAnIh41kBJiiOFLcUwRWncXkndxk9x3uxHmS0h1uvunztzoCJZ0LpAXS9CEdn7zxvWozyd4lVJG8lCgXlLCn0kbHwnvx28vyS8UNQhQrKP+YbNz7DQ0082LgoCs= Original-Received: by 10.90.52.18 with SMTP id z18mr2671808agz.1192095764416; Thu, 11 Oct 2007 02:42:44 -0700 (PDT) Original-Received: by 10.90.103.8 with HTTP; Thu, 11 Oct 2007 02:42:44 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-Detected-Kernel: Linux 2.6 (newer, 2) 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:80597 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. Juanma 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.