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

From: Manuel Giraud <[email-masked]>
Date: Wed, 07 May 2025 10:07:04 +0200

Michael Heerdegen <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>> Each face has a meaning, I presume?  If one face marks a date because
>> John Doe was born at that day, and another face marks the same date
>> because I have an important meeting, then the latter should "win",
>> right?
>
> It depends?  If John doe is your husband, maybe he is much more
> important and should "win".  Maybe you will have a free day at his
> birthday anyway.
>
> Or: if it's three weeks before that day, John's birthday is more
> relevant, because I might need to buy presents.  But one day before that
> date I have the presents and have been informed about the birthday, but
> I want to be reminded about the meeting now.
>
> So this is a good example of how difficult this is.  It totally depends
> on your life and your circumstances.  Also, Emacs doesn't know what an
> "important meeting" is, and who John Doe is.
>
> And the same is true for other sources of highlighting.  Are holidays
> important?  Depends on how religious you are etc.

Thanks Michael for this detailed explanation.  That was exactly the kind
of complications I also imaged and this is why I suggest having a way
for the user to set this "priority/importance".

>> Not names, meanings.  The names here don't explain themselves: 'diary'
>> and 'success'.  If you know what those faces mean, please tell, and I
>> will try to suggest which one should win in this case.
>
> Note: the success face had been specified in the diary file (see the
> recipe).  The user can specify any face name in the file.  Emacs doesn't
> know what these "mean".  The only thing Emacs can know is: was the entry
> that caused the mark a normal diary entry, a sexp entry, or does the
> mark come from some function or via a hook - with other words, a rough
> category that doesn't tell much on it's own.
>
>> (Up front, I'd say that 'diary' should override the others, but I'm
>> open to counter-arguments.)
>
> May suggestion: first, when Emacs tries to mark a date, and there is
> already a mark, we use the existing overlay instead of placing
> multiple.

This may be a good idea but overlapping overlays can handle some cases
very well: for example, it combines correctly a face that sets a certain
foreground color and 'italic.  So in such case, we could have two pieces
of information.

> Then, a function, value of a new defcustom, is used to decide what face
> to place in a conflict.  And I would introduce a new face that means
> "multiple marks on this date" that it can use.

Ok, but then it is up to the user to write such a function.  It is, of
course, a more flexible interface but also a harder one: the user need
to write lisp instead choosing some "priority" values.  And also, it
does not prevent us from having a default function for this custom:
we're back to square one ;-)

> But more importantly, it would be good if the mouse over text would list
> the entries for that day.  Much more useful than programming face
> fights.  Just give me a hint that there are multiple things "on" that
> date.  This feature (listing diary entries for the clicked date) is
> already available by explicit request via the mouse-3 menu btw.

Yes, this feature is already available (via 'diary-view-entries').  It
is just not a hover.
-- 
Manuel Giraud