"Roland Winkler" <wink...@gnu.org> writes: > On Thu Nov 28 2013 Uwe Brauer wrote: >> I use >> (require 'bbdb-anniv) >> (add-hook 'list-diary-entries-hook #'bbdb-include-anniversaries) >> >> In my 2.35 bbdb version and I do see the anniversaries marked in the >> calendar. Are you saying this is not possible in vs 3? > > You are talking about which version of bbdb-anniv.el and which > version of Emacs? > > For bbdb 2.35, I only know bbdb-anniv.el by Ivar Rummelhoff (dated > 1998). This code uses add-to-diary-list to communicate with diary, > and this function is also used by bbdb-anniv.el in BBDB 3. With > recent versions of GNU Emacs, add-to-diary-list only works with the > diary buffer, but -to the best of my knowledge- it cannot mark these > entries in the calendar buffer. > > I'd certainly be glad to know if and how this approach can also be > extended to marking entries in the calendar buffer. > > Roland
It might be worth looking at the code in org-bbdb.el: org-bbdb-make-anniv-hash builds a hash table of all anniversaries in the BBDB, which would be a useful starting place. Key is (month date), value is ((year record-name anniversary-type) (year record-name anniversary-type) etc). Load org-bbdb.el and populate the hash with org-bbdb-make-anniv-hash. Then some setup: (add-hook 'calendar-move-hook (lambda () (maphash (lambda (k v) (calendar-mark-visible-date `(,(car k) ,(cadr k) ,displayed-year)) ; later add custom face org-bbdb-anniv-hash))) And then this, a mashup of calendar-cursor-holidays and bbdb-anniv-diary-entries: (defun bbdb-anniv-cursor-anniv (&optional date) (interactive) (or date (setq date (calendar-cursor-to-date t))) (let* ((date-string (calendar-date-string date)) (m (car date)) (d (second date)) (anniv-list (gethash (list m d) org-bbdb-anniv-hash)) leaps msg) ;; leap year handling from bbdb-anniv (when (and (= m 3) (= d 1) (not (null (gethash (list 2 29) org-bbdb-anniv-hash))) (not (calendar-leap-year-p y))) (setq leaps (gethash (list 2 29) org-bbdb-anniv-hash)) (mapcar (lambda (l) (push l anniv-list)) leaps)) (when anniv-list (setq msg (format "%s: %s" date-string (mapconcat (lambda (a) (let ((form (cdr (assoc (intern (nth 2 a)) bbdb-anniv-alist))) yy text ord) (setq yy (if (car a) (- (calendar-extract-year date) (car a)) 100) ord (when (> yy 0) (diary-ordinal-suffix yy)) text (or form "unspecified for %n") text (replace-regexp-in-string "\\`[ \t]+" "" text) text (replace-regexp-in-string "[ \t]+\\'" "" text) text (replace-regexp-in-string "%n" (nth 1 a) text)) (if (and yy ord) (format text yy ord) text))) anniv-list "; "))) (message "%s" msg)))) (add-hook 'calendar-mode-hook (lambda () (define-key calendar-mode-map (kbd "b") 'bbdb-anniv-cursor-anniv))) This is the simplest hack, but obviously we wouldn't want to borrow org code, and bbdb-anniv could probably use some refactoring. But it's a starting place. Would a separate anniversary hash table be something desirable in BBDB itself? Or Anyway, food for thought. Eric ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/