From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gerd.moellmann@t-online.de (Gerd Moellmann) Newsgroups: gmane.emacs.devel Subject: Re: question about frame local variable Date: 10 Nov 2003 11:35:59 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <863ccwjysw.fsf@gerd.free-bsd.org> References: <200310250049.JAA12659@etlken.m17n.org> <200310280803.RAA05883@etlken.m17n.org> <200310300135.KAA09225@etlken.m17n.org> <86k76njcj4.fsf@gerd.free-bsd.org> <86oevy1pxp.fsf@gerd.free-bsd.org> <200311100105.KAA28811@etlken.m17n.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068461947 8098 80.91.224.253 (10 Nov 2003 10:59:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 10 Nov 2003 10:59:07 +0000 (UTC) Cc: emacs-devel@gnu.org, monnier@IRO.UMontreal.CA, rms@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Nov 10 11:59:04 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJ9l9-0001Oy-00 for ; Mon, 10 Nov 2003 11:59:03 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJ9l9-0003xF-00 for ; Mon, 10 Nov 2003 11:59:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AJARi-0003Jj-SW for emacs-devel@quimby.gnus.org; Mon, 10 Nov 2003 06:43:02 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AJAPR-0003JD-2w for emacs-devel@gnu.org; Mon, 10 Nov 2003 06:40:41 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AJAOj-0003DV-5w for emacs-devel@gnu.org; Mon, 10 Nov 2003 06:40:29 -0500 Original-Received: from [194.25.134.82] (helo=mailout05.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AJAMx-00034r-W5; Mon, 10 Nov 2003 06:38:08 -0500 Original-Received: from fwd00.aul.t-online.de by mailout05.sul.t-online.com with smtp id 1AJ9PO-00048y-01; Mon, 10 Nov 2003 11:36:34 +0100 Original-Received: from gerd.free-bsd.org (XND5WgZdQeoRclVTDm0D4g90umWqLAhjbKM5a9y8lMyB9JBzig5ioU@[217.230.102.43]) by fwd00.sul.t-online.com with esmtp id 1AJ9Ow-1g0bvU0; Mon, 10 Nov 2003 11:36:06 +0100 Original-Received: from gerd.free-bsd.org (localhost [127.0.0.1]) by gerd.free-bsd.org (8.12.10/8.12.10) with ESMTP id hAAAa2d4000369; Mon, 10 Nov 2003 11:36:03 +0100 (CET) (envelope-from gerd.moellmann@t-online.de) Original-Received: (from gerd@localhost) by gerd.free-bsd.org (8.12.10/8.12.10/Submit) id hAAAZxHS000366; Mon, 10 Nov 2003 11:35:59 +0100 (CET) (envelope-from gerd.moellmann@t-online.de) X-Authentication-Warning: gerd.free-bsd.org: gerd set sender to gerd.moellmann@t-online.de using -f Original-To: Kenichi Handa In-Reply-To: <200311100105.KAA28811@etlken.m17n.org> Original-Lines: 48 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-Seen: false X-ID: XND5WgZdQeoRclVTDm0D4g90umWqLAhjbKM5a9y8lMyB9JBzig5ioU X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:17750 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17750 Kenichi Handa writes: > I found this code in redisplay_window (xdisp.c). > > /* Really select the buffer, for the sake of buffer-local > variables. */ > set_buffer_internal_1 (XBUFFER (w->buffer)); > > Perhaps, we should call > select_frame_internal_for_variables_only around there. I think the best place is in redisplay_internal, which redisplays frame by frame. Otherwise, we'd end up doing this for each window on a frame again and again. I can't work on this, but maybe this is helpful: void select_frame_for_redisplay (Lisp_Object frame) { Lisp_Object tail, sym, val; selected_frame = frame; for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) if (CONSP (XCAR (tail)) && (sym = XCAR (XCAR (tail)), SYMBOLP (sym)) && (sym = indirect_variable (sym), val = SYMBOL_VALUE (sym), (BUFFER_LOCAL_VALUEP (val) || SOME_BUFFER_LOCAL_VALUEP (val))) && XBUFFER_LOCAL_VALUE (val)->check_frame) Fsymbol_value (sym); } This works analogous to what set_buffer does for buffer-local variables (hopefully; I haven't tried anything): For all frame parameters P, check if a frame-local variable P exists. If so, swap P's value in by calling Fsymbol_value. That works because the innards of Fsymbol_value compare the frame recorded in the local value with the currently selected frame. In redisplay_internal, call the function with the frame being displayed, and in an unwind-protect handler (I think there is already one), call it to restore the original selected frame and its values. HTH