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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 22 Jun 2025 21:13:23 +0300

> From: Manuel Giraud <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 22 Jun 2025 18:22:15 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Manuel Giraud <[email-masked]>
> >> Cc: [email-masked]
> >> Date: Sun, 22 Jun 2025 16:08:37 +0200
> >> 
> >> Eli Zaretskii <[email-masked]> writes:
> >> 
> >> > If the above is the best scenario you can offer, then please point me
> >> > to the code in calendar that first draws the numbers in black and then
> >> > redraws them in red, and I will take a look.
> >> 
> >> Thanks Eli.  I think most takes place in `diary-mark-entries' at
> >> diary-lib.el:1377.
> >
> > Thanks.  Then I guess the problem is the calls to sit-for, which
> > performs redisplay, in calendar-generate-window before it calls
> > diary-mark-entries.  Any idea why we are calling sit-for there?  If
> > you remove those calls or add the optional second argument non-nil to
> > them, does the problem go away?
> 
> Thanks.  I have commented both sit-for and the issue completely goes
> away.  I dig into history and those sit-for are here from ecaa0527104b
> (the initial revision in 1992!)

Can you (or anyone else) think of any reasons to have these sit-for
calls there?  For example, when there's no need to call
diary-mark-entries at all?

If we can think of no valid reason, I think TRT is simply to remove
these calls.  It's possible that this was there for when Emacs had a
completely different way of fontifying buffers than what we have now.