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

From: Eric Abrahamsen <[email-masked]>
Date: Sat, 14 Aug 2021 11:08:13 -0700

Michael Heerdegen <[email-masked]> writes:

> Eric Abrahamsen <[email-masked]> writes:
>
>> Oof, EBDB's diary integration was "write once and back away slowly"
>> code. I'm trying to understand diary-lib.el. So far as I can see, when
>> you add diary entries to `diary-entry-list' [...]
>
> Suggestion: provide a new diary-sexp function, similar to
> `diary-lunar-phases'.  Then marking would be handled by the diary.
>
> That function just has to return nil or a string (or a mark and a
> string) depending on the dynamical variable DATE.  That's already the
> whole diary related part.  People then have to add that function as sexp
> entry to their diary if they want.

Oh, huh: sort of inverting the prior approach. I find all this a little
confusing, I've never spent any time with the diary, and its integration
with Org always seemed very mysterious to me. But I do think the
calendar integration is very useful.

So the idea is that there would be a `ebdb-diary-anniversaries'
function, that looks sort of like:

(defun ebdb-diary-anniversaries (&optional mark)
  (with-suppressed-warnings ((lexical date))
    (defvar date))
  (when-let ((anniv-today (ebdb-get-anniversaries-for-date date)))
    (cons mark (mapconcat #'identity anniv-today "\n"))))

Something like that, anyway, and then users put

%%(ebdb-diary-anniversaries)

In their diary file? And that would get called once per visible date, so
potentially a whole lot, so `ebdb-get-anniversaries-for-date' should be
quick...

Anyway, thanks for this alternate suggestion! This wouldn't have
occurred to me.

Eric