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: Wed, 17 Oct 2007 19:53:03 -0400 Message-ID: References: <858x65lh4m.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1192673442 28670 80.91.229.12 (18 Oct 2007 02:10:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2007 02:10:42 +0000 (UTC) Cc: lekktu@gmail.com, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 18 04:10:43 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 1IiKqQ-0004Gc-Ge for ged-emacs-devel@m.gmane.org; Thu, 18 Oct 2007 04:10:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IiKqJ-0002VF-2M for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2007 22:10:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IiKqF-0002Um-7l for emacs-devel@gnu.org; Wed, 17 Oct 2007 22:10:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IiKqD-0002Ua-PQ for emacs-devel@gnu.org; Wed, 17 Oct 2007 22:10:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IiKqD-0002UX-Kk for emacs-devel@gnu.org; Wed, 17 Oct 2007 22:10:29 -0400 Original-Received: from tomts13.bellnexxia.net ([209.226.175.34] helo=tomts13-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IiKq4-0002XP-Uf; Wed, 17 Oct 2007 22:10:21 -0400 Original-Received: from ceviche.home ([74.12.207.168]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20071018021017.XXQU13659.tomts13-srv.bellnexxia.net@ceviche.home>; Wed, 17 Oct 2007 22:10:17 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id DE998B41C1; Wed, 17 Oct 2007 19:53:03 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Mon\, 15 Oct 2007 13\:50\:36 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) 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:81118 Archived-At: >> I found the discussion. I see that someone asked for a feature to >> display frame-specific data in the mode line, and I decided this >> general feature (with which the job could be done) was cleaner and >> simpler than a specific feature which could do only that one job. > That's a reasonable request, and indeed there are situations where we can > lookup a variable but we cannot call a function which could potentially run > arbitrary code. > Maybe that's enough to keep the feature. >> Since it isn't very useful, we can take it out if we cannot fix it. >> But first let's try to fix it. > But the above request does not mean we need to be able to mix&match > let-bindings, buffer-local, and frame-local variables. If we disallowed the > buffer-local&frame-local variables, the problem would disappear. This part > of the language is already complex enough as it stands. More specifically, I propose to change the manual to say that we cannot mix buffer-local and frame-local with a single variable (just like a variable cannot be both buffer-local and keyboard-local or keyboard-local and frame-local). This could come with the attached change in the code, which would fix the OP's problem by signalling the odd situation earlier. This would be installed on the 22 branch, since it's obviously safe. Stefan Index: data.c =================================================================== RCS file: /sources/emacs/emacs/src/data.c,v retrieving revision 1.280 diff -u -u -b -r1.280 data.c --- data.c 16 Oct 2007 15:42:58 -0000 1.280 +++ data.c 17 Oct 2007 23:47:34 -0000 @@ -1521,7 +1521,9 @@ variable = indirect_variable (variable); valcontents = SYMBOL_VALUE (variable); - if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) + if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents) + || (BUFFER_LOCAL_VALUEP (valcontents) + && XBUFFER_LOCAL_VALUE (valcontents)->check_frame)) error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); if (BUFFER_OBJFWDP (valcontents)) @@ -1578,7 +1580,9 @@ variable = indirect_variable (variable); valcontents = SYMBOL_VALUE (variable); - if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) + if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents) + || (BUFFER_LOCAL_VALUEP (valcontents) + && XBUFFER_LOCAL_VALUE (valcontents)->check_frame)) error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); if ((BUFFER_LOCAL_VALUEP (valcontents) @@ -1733,8 +1737,9 @@ variable = indirect_variable (variable); valcontents = SYMBOL_VALUE (variable); - if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents) - || BUFFER_OBJFWDP (valcontents)) + if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents) + || (BUFFER_LOCAL_VALUEP (valcontents) + && !XBUFFER_LOCAL_VALUE (valcontents)->check_frame)) error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); if (BUFFER_LOCAL_VALUEP (valcontents)) Diffs between working revision and workfile end here.