Subject: Re: bug#49995: 28.0.50; EBDB Anniversaries do not appear marked in calendar

From: Michael Heerdegen <[email-masked]>
Date: Tue, 17 Aug 2021 19:16:00 +0200

Eric Abrahamsen <[email-masked]> writes:

> And, because I apparently have nothing else to do on a weekend, here's a
> version that just calls a function directly, nothing fancy. Some overlap
> with `diary-anniversary', but nothing terrible. This is probably the
> best approach.

Yes, looks like more or less what I had suggested.  Hope it turns out it
was the right advice.

> -;; `ebdb-field-anniv-diary-entry' is defined below.
> +(defun ebdb-diary-anniversaries (&optional mark)
> +  (with-no-warnings
> +    (defvar date)
> +    (defvar original-date))
> +  (when-let ((entries (gethash (seq-subseq date 0 2) ebdb-diary-entries)))
> +    (cons mark
> +	  (mapconcat (pcase-lambda (`(,field ,record))
> +		       (if (bound-and-true-p original-date)
> +			   ;; If we have `original-date', we're
> +			   ;; displaying the diary list, so we need
> +			   ;; the detailed string.
> +			   (ebdb-field-anniv-diary-entry
> +			    field record (nth 2 date))
> +			 ;; If not, we're just marking dates on the
> +			 ;; calendar, so any non-nil response value is
> +			 ;; fine.
> +			 entry))
> +		     entries "; "))))

Do you really expect that this if-clause has a measurable effect on
performance?  Most people will not have thousands of anniversaries in
their database (and even then, they probably don't want to have them all
listed).  OTOH you now need to rely on an internal aspect of the
implementation.

Some more thoughts about this matter:

Do have a version for the Org agenda?  I see BBDB has
`org-bbdb-anniversaries'.  It handles the 2/29 problem btw.

What I as a user would wish (for the Diary and Org) would be a way to
control on a per-field basis (1) which anniversaries are listed, (2) how
they are presented and (3) a way to allow reminders for some (I might
need some weeks time to buy a present for some people, while I only want
to congratulate others so I don't need a reminder for most).

Regards,

Michael.