Subject: Re: bug#78120: 31.0.50; Calendar is not reliable with its marking

From: Michael Heerdegen <[email-masked]>
Date: Mon, 05 May 2025 02:45:37 +0200

Eli Zaretskii <[email-masked]> writes:

> I can reproduce this.

Yes, I can...I can too, of course.  Yesterday was the date used in the
recipe so I thought it would be a good idea to change it but... anyway.

> I think the reason is simple: the above scenario places 2 overlays on
> that date, each one of them specifying a different face.  Type "M-x
> describe-text-properties" on that date, and you will see it: one face
> is 'diary', the other 'success'.  One of these overlays comes from
> diary-mark-sexp-entries, the other from calendar-mark-visible-date.

(`diary-mark-sexp-entries' calls `calendar-mark-visible-date'.  I think
the latter is used more or less everywhere in diary-lib to place the
overlays.)

> Both overlays have the same (unspecified) priority, so which one of
> them "wins" depends on many factors, including the exact memory layout
> of the Emacs session.  The latter changes each time you press 'm', so
> you sometimes see one or the other face.

Plausible. (Would it be thinkable to make the behavior deterministic?)

> The solution is to decide which overlay should "win" in this case, and
> give one of them higher or lower priority, as appropriate.

This might not be easy, though (I mean the "appropriate" part), since
there are multiple different places in diary-lib that mark dates.  And
of course there is also the problem of multiple matches of one source,
for example, multiple sexps matching the date that want to draw
different faces.

Michael.