From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#52298: 29.0.50; Frequent redisplay cycles induced by c-type-finder-timer-func timer in CC Mode Date: Fri, 10 Dec 2021 18:16:21 +0000 Message-ID: References: <83sfv74hpm.fsf@gnu.org> <83wnkeuufz.fsf@gnu.org> <838rwttsxj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37965"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 52298@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 10 19:17:15 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvkSI-0009fG-ND for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Dec 2021 19:17:14 +0100 Original-Received: from localhost ([::1]:45260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvkSH-0000wo-3z for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Dec 2021 13:17:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvkS7-0000sq-Rf for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2021 13:17:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36345) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mvkS6-0007Xt-BH for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2021 13:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mvkS6-0007yG-3H for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2021 13:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Dec 2021 18:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52298 X-GNU-PR-Package: emacs Original-Received: via spool by 52298-submit@debbugs.gnu.org id=B52298.163916018930586 (code B ref 52298); Fri, 10 Dec 2021 18:17:02 +0000 Original-Received: (at 52298) by debbugs.gnu.org; 10 Dec 2021 18:16:29 +0000 Original-Received: from localhost ([127.0.0.1]:47891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mvkRZ-0007xG-1T for submit@debbugs.gnu.org; Fri, 10 Dec 2021 13:16:29 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:56596 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mvkRX-0007x1-QS for 52298@debbugs.gnu.org; Fri, 10 Dec 2021 13:16:28 -0500 Original-Received: (qmail 90697 invoked by uid 3782); 10 Dec 2021 18:16:21 -0000 Original-Received: from acm.muc.de (p4fe15e51.dip0.t-ipconnect.de [79.225.94.81]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 10 Dec 2021 19:16:21 +0100 Original-Received: (qmail 7044 invoked by uid 1000); 10 Dec 2021 18:16:21 -0000 Content-Disposition: inline In-Reply-To: <838rwttsxj.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222080 Archived-At: Hello, Eli. On Thu, Dec 09, 2021 at 22:38:32 +0200, Eli Zaretskii wrote: > > Date: Thu, 9 Dec 2021 20:11:32 +0000 > > Cc: 52298@debbugs.gnu.org, acm@muc.de > > From: Alan Mackenzie [ .... ] > It seems the reason is not the 'fontified' property, it's the > 'c-is-sws' property that c-forward-sws puts on the buffer text. I > show the backtrace below. There's also the 'c-type' property that > c-get-fontification-context puts; see the second backtrace below. Thanks for the debugging! > Both of these are called from the timer function. Are they using > with-silent-modifications? I'm pretty sure they are. I think that modify_text_properties is calling modiff_incr even when inhibit_modification_hooks is non-nil. I tried putting an `if' around that bit of the code, without any great success. The main reason for all the redisplaying (which I got from trace-redisplay displaying "redisplay_preserve_echo_area (8)") is the call from detect_input_pending_run_timers in keyboard.c. It is calling redisplay_preserve_echo_area each time the timer triggers. The call to detect_input_pending_run_timers (true) (that argument being `do_display') seems to be in dispnew.c, assuming it's not in process.c. I'll need to look further into this. > The result of this is that the buffer's modification tick is increased > all the time, and redisplay_window then decides that the current glyph > matrix is not up-to-date, which means it must work harder to decide > how to redisplay this window. > Here are the two backtraces I promised: > #0 0x013118d6 in modiff_incr (a=0x6ee5310) at lisp.h:3552 > #1 0x0131203e in modify_text_properties (buffer=XIL(0xa000000006ee50a0), > start=make_fixnum(39237), end=make_fixnum(39238)) at textprop.c:91 > #2 0x01316a2b in add_text_properties_1 (start=make_fixnum(39237), > end=make_fixnum(39238), properties=XIL(0xc00000000082b538), > object=XIL(0xa000000006ee50a0), set_type=TEXT_PROPERTY_REPLACE, > destructive=true) at textprop.c:1224 > #3 0x01316ef0 in Fadd_text_properties (start=make_fixnum(39237), > end=make_fixnum(39238), properties=XIL(0xc00000000082b538), object=XIL(0)) > at textprop.c:1296 > #4 0x01316fcf in Fput_text_property (start=make_fixnum(39237), > end=make_fixnum(39238), property=XIL(0x56056f0), value=XIL(0x30), > object=XIL(0)) at textprop.c:1314 > #5 0x012670c5 in funcall_subr (subr=0x17216a0 , > numargs=4, args=0x82b790) at eval.c:3152 [ .... ] > Lisp Backtrace: > "put-text-property" (0x82b790) > "c-forward-sws" (0x82c0a8) > "c-fl-decl-start" (0x82c7d8) > "c-context-expand-fl-region" (0x82cdd0) > 0x753e6b0 PVEC_COMPILED > "mapc" (0x82d688) > "c-before-context-fl-expand-region" (0x82dc90) > "c-type-finder-timer-func" (0x82e530) > "apply" (0x82e528) > "timer-event-handler" (0x82eba8) > ---------------------------------------------------------------------- > #0 0x013118d6 in modiff_incr (a=0x6ee5310) at lisp.h:3552 > #1 0x0131203e in modify_text_properties (buffer=XIL(0xa000000006ee50a0), > start=make_fixnum(39339), end=make_fixnum(39340)) at textprop.c:91 > #2 0x01316a2b in add_text_properties_1 (start=make_fixnum(39339), > end=make_fixnum(39340), properties=XIL(0xc00000000082b258), > object=XIL(0xa000000006ee50a0), set_type=TEXT_PROPERTY_REPLACE, > destructive=true) at textprop.c:1224 > #3 0x01316ef0 in Fadd_text_properties (start=make_fixnum(39339), > end=make_fixnum(39340), properties=XIL(0xc00000000082b258), object=XIL(0)) > at textprop.c:1296 > #4 0x01316fcf in Fput_text_property (start=make_fixnum(39339), > end=make_fixnum(39340), property=XIL(0x57a2ff8), value=XIL(0x566adc8), > object=XIL(0)) at textprop.c:1314 > #5 0x012670c5 in funcall_subr (subr=0x17216a0 , > numargs=4, args=0x82b478) at eval.c:3152 [ .... ] > Lisp Backtrace: > "put-text-property" (0x82b478) > "c-get-fontification-context" (0x82bc88) > 0x7581bc8 PVEC_COMPILED > "c-find-decl-spots" (0x82d638) > "c-find-types-background" (0x82dc98) > "c-type-finder-timer-func" (0x82e530) > "apply" (0x82e528) > "timer-event-handler" (0x82eba8) > (gdb) fr 4 > #4 0x01316fcf in Fput_text_property (start=make_fixnum(39339), > end=make_fixnum(39340), property=XIL(0x57a2ff8), value=XIL(0x566adc8), > object=XIL(0)) at textprop.c:1314 > 1314 Fadd_text_properties (start, end, properties, object); > (gdb) pp property > c-type -- Alan Mackenzie (Nuremberg, Germany).