Subject: Re: bug#78861: [PATCH] Avoid calendar flicker

From: Eli Zaretskii <[email-masked]>
Date: Sun, 22 Jun 2025 17:38:12 +0300

> From: Stephen Berman <[email-masked]>
> Cc: Manuel Giraud <[email-masked]>,  [email-masked]
> Date: Sun, 22 Jun 2025 15:55:26 +0200
> 
> I don't see any flickering or redrawing with that recipe, but in my
> calendar and diary configuration I do see what looks like delayed
> fontification of certain date marking.  I've narrowed the issue down to
> a combination of marking lunar phases and having a sufficiently large
> number of diary entries (in my case due to including several todo-mode
> files).  Here is a recipe:
> 
> 0. Make ~/.emacs.d/diary consist of the following lines:
> -------------------------------
> %%(diary-lunar-phases 'warning)
> Jun 22, 2025 test
> -------------------------------
> and then repeat the second line a large number of times (5000 shows the
> issue clearly on my machine, 1000 shows it too, but not as clearly).
> 1. emacs -Q
> 2. M-x calendar
> 3. Hit 'm' and then alternatively '>' and '<'.
> 
> On typing 'm' there is a noticeable delay before the dates are marked,
> on the first scroll command also a noticeable delay but not as long, on
> subsequent scroll commands much less delay but enough to see the dates
> first with default face, then change to warning face.  With Manuel's
> patch let-binding 'inhibit-redisplay', there are still delays when
> scrolling but the lunar phase dates are shown in warning face as soon as
> the scroll happens.

Is this an interesting case?  Do people frequently have thousands of
such lines in their ~/diary files?

Anyway, what triggers the fontifications that are evidently done after
the initial display?  Are there any timers involved, perhaps?  IOW,
why isn't the buffer fontified immediately?