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

From: Manuel Giraud <[email-masked]>
Date: Sun, 22 Jun 2025 16:08:37 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Manuel Giraud <[email-masked]>
>> Cc: [email-masked]
>> Date: Sun, 22 Jun 2025 13:46:28 +0200
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> From: Manuel Giraud <[email-masked]>
>> >> Date: Sun, 22 Jun 2025 09:00:02 +0200
>> >> 
>> >> When you have diary marks activated in the calendar (with 'm',
>> >> diary-mark-entries) and when moving around (for example with '<' and
>> >> '>') you will see some flicker on dates where you have marks.
>> >
>> > Please elaborate: which part(s) of the display flicker?  I tried a
>> > simple recipe to reproduce the problem, and saw no flickering on my
>> > system.
>> 
>> I see the date digits flicker when moving: the digits glimpse in black
>> before turning to red (with default theme).
>
> I don't see anything like that here.
>
>> Here is a recipe:
>>      - emacs -Q
>>      - Open "/tmp/diary" and insert the following content:
>> --8<---------------cut here---------------start------------->8---
>> %%(diary-block 6 22 2025 8 30 2025) Looong break
>> --8<---------------cut here---------------end--------------->8---
>>      - M-: (setq diary-file "/tmp/diary") <RET>
>>      - M-x calendar <RET>
>>      - Hit 'm' and then alternatively '>' and '<' to see the flicker
>
> I see the entire window being redrawn, so it's hard to see a flicker.
> Seeing flickering requires that everything stays the same and in the
> same position in the window, otherwise it's impossible to say that
> there's flickering when everything moves and changes.

Fair enough.  Here is (maybe) another way to see this flickering I'm
seeing: same first four points of the recipe and then you could hit 'm'
repeatedly.  Nothing should move but I still see a flicker.

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

>> > And what is the state of double-buffering in the session where you saw
>> > it?
>> 
>> I'm not sure but I think I'm good.  Here's an excerpt of xdpyinfo:
>
> No, I meant whether your build is with double-buffering?

I think so. I don't think I use any build option that could inhibit this.
-- 
Manuel Giraud