From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: question about frame local variable Date: Tue, 11 Nov 2003 17:38:23 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200311110838.RAA01590@etlken.m17n.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> <863ccwjysw.fsf@gerd.free-bsd.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1068540354 31031 80.91.224.253 (11 Nov 2003 08:45:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 Nov 2003 08:45:54 +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 Tue Nov 11 09:45:51 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 1AJU9n-0002Be-00 for ; Tue, 11 Nov 2003 09:45:51 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJU9m-000789-00 for ; Tue, 11 Nov 2003 09:45:50 +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 1AJV1F-0006ML-In for emacs-devel@quimby.gnus.org; Tue, 11 Nov 2003 04:41:05 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AJV18-0006Lb-Vc for emacs-devel@gnu.org; Tue, 11 Nov 2003 04:40:58 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AJV0c-0006I0-T8 for emacs-devel@gnu.org; Tue, 11 Nov 2003 04:40:57 -0500 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AJV06-0006Cx-Nj; Tue, 11 Nov 2003 04:39:54 -0500 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2]) by tsukuba.m17n.org (8.11.6p2/3.7W-20010518204228) with ESMTP id hAB8cNh00952; Tue, 11 Nov 2003 17:38:23 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.6/3.7W-20010823150639) with ESMTP id hAB8cNs24220; Tue, 11 Nov 2003 17:38:23 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id RAA01590; Tue, 11 Nov 2003 17:38:23 +0900 (JST) Original-To: gerd.moellmann@t-online.de In-reply-to: <863ccwjysw.fsf@gerd.free-bsd.org> (gerd.moellmann@t-online.de) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) 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:17767 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17767 In article <863ccwjysw.fsf@gerd.free-bsd.org>, gerd.moellmann@t-online.de (Gerd Moellmann) writes: >> 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; [...] Thank you very much for the help. I'm now using the attached patch. It seems that frame-local variables are handled correctly. Richard, what do you think about this change. Shall I install it? --- Ken'ichi HANDA handa@m17n.org *** xdisp.c.~1.849.~ Mon Oct 13 11:25:49 2003 --- xdisp.c Tue Nov 11 17:24:48 2003 *************** *** 814,819 **** --- 814,820 ---- static void push_it P_ ((struct it *)); static void pop_it P_ ((struct it *)); static void sync_frame_with_window_matrix_rows P_ ((struct window *)); + static void select_frame_for_redisplay P_ ((Lisp_Object)); static void redisplay_internal P_ ((int)); static int echo_area_display P_ ((int)); static void redisplay_windows P_ ((Lisp_Object)); *************** *** 9542,9547 **** --- 9543,9586 ---- } } + + /* Select FRAME to forward the values of frame-local variables into C + variables so that the redisplay routines can access those values + directly. */ + + static void + select_frame_for_redisplay (frame) + Lisp_Object frame; + { + Lisp_Object tail, sym, val; + Lisp_Object old = selected_frame; + + 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); + + for (tail = XFRAME (old)->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); + } + + #define STOP_POLLING \ do { if (! polling_stopped_here) stop_polling (); \ polling_stopped_here = 1; } while (0) *************** *** 9607,9613 **** /* Record a function that resets redisplaying_p to its old value when we leave this function. */ count = SPECPDL_INDEX (); ! record_unwind_protect (unwind_redisplay, make_number (redisplaying_p)); ++redisplaying_p; specbind (Qinhibit_free_realized_faces, Qnil); --- 9646,9653 ---- /* Record a function that resets redisplaying_p to its old value when we leave this function. */ count = SPECPDL_INDEX (); ! record_unwind_protect (unwind_redisplay, ! Fcons (make_number (redisplaying_p), selected_frame)); ++redisplaying_p; specbind (Qinhibit_free_realized_faces, Qnil); *************** *** 10021,10026 **** --- 10061,10071 ---- if (FRAME_WINDOW_P (f) || f == sf) { + if (! EQ (frame, selected_frame)) + /* Select the frame, for the sake of frame-local + variables. */ + select_frame_for_redisplay (frame); + #ifdef HAVE_WINDOW_SYSTEM if (clear_face_cache_count % 50 == 0 && FRAME_WINDOW_P (f)) *************** *** 10273,10285 **** /* Function registered with record_unwind_protect in redisplay_internal. Reset redisplaying_p to the value it had before redisplay_internal was called, and clear ! prevent_freeing_realized_faces_p. */ static Lisp_Object ! unwind_redisplay (old_redisplaying_p) ! Lisp_Object old_redisplaying_p; { redisplaying_p = XFASTINT (old_redisplaying_p); return Qnil; } --- 10318,10337 ---- /* Function registered with record_unwind_protect in redisplay_internal. Reset redisplaying_p to the value it had before redisplay_internal was called, and clear ! prevent_freeing_realized_faces_p. It also selects the previously ! selected frame. */ static Lisp_Object ! unwind_redisplay (val) ! Lisp_Object val; { + Lisp_Object old_redisplaying_p, old_frame; + + old_redisplaying_p = XCAR (val); redisplaying_p = XFASTINT (old_redisplaying_p); + old_frame = XCDR (val); + if (! EQ (old_frame, selected_frame)) + select_frame_for_redisplay (old_frame); return Qnil; }