Eric Abrahamsen writes: > Michael Heerdegen writes: > >> Eric Abrahamsen 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. Okay, here's a version of how it might work. I've learned a little bit more about the diary (and as a result will likely use it more! I'd always thought it was just a poor cousin to Org, but I see it has its own strengths), and have a solution that is a bit funky, but might be okay. If Michael or anyone with a better understanding of diary than me would comment on this, I'd very much appreciate it. So the user puts "%%(ebdb-diary-anniversaries)" as a sexp in their diary. That function gets called in two situations: marking dates in the calendar (it gets called *many* times but only has to return a boolean), and listing diary entries for a particular date (it only gets called once, but has to produce more detailed information). The function checks (bound-and-true-p 'original-date) to know which situation it's in. At load time EBDB builds some prep data in a hash table, and that data feels messy, but the strategy is to do a medium amount of work at load time, the absolute minimum amount of work when marking dates in the *Calendar* (essentially checks "does this hash key have a value"), and again a medium amount of work when displaying diary entries for a particular day. I would love some feedback on this! Eric