Subject: Re: bug#52298: 29.0.50; Frequent redisplay cycles induced by c-type-finder-timer-func timer in CC Mode

From: Eli Zaretskii <[email-masked]>
Date: Fri, 10 Dec 2021 20:51:32 +0200

> Date: Fri, 10 Dec 2021 18:16:21 +0000
> Cc: [email-masked], [email-masked]
> From: Alan Mackenzie <[email-masked]>
> 
> > 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.

AFAIK, with-silent-modifications is supposed to prevent BUF_MODIFF
from increasing.  Are you sure you see that?  And what kind of 'if'
did you try to put and where?

> 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.

This is normal, not something you need to investigate: every time a
timer function fires, we make one more iteration through the Emacs
idle loop, and that includes a call to redisplay_preserve_echo_area.

Once again, the problem is not that redisplay is invoked, the problem
is that it doesn't exit almost immediately, after detecting that
nothing's changed.