Re: BBDB anniversaries in the calendar/diary
Roland == Roland Winkler wink...@gnu.org writes: On Fri Nov 29 2013 Uwe Brauer wrote: Exactly. - Your screenshot is from Xemacs? That could explain the difference. I do not know anything about it. Yes, 21.4.X or 21.5.33. smime.p7s Description: S/MIME cryptographic signature -- 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=84349351iu=/4140/ostg.clktrk___ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/
Re: BBDB anniversaries in the calendar/diary
On Sat Nov 30 2013 Uwe Brauer wrote: Yes, 21.4.X or 21.5.33. So it seems I did not overlook anything when I filed bug#15987 for GNU Emacs. -- 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=84349351iu=/4140/ostg.clktrk ___ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/
Re: BBDB anniversaries in the calendar/diary
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=84349351iu=/4140/ostg.clktrk ___ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/
Re: BBDB anniversaries in the calendar/diary
On Sun Dec 1 2013 Eric Abrahamsen wrote: 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. There are various possibilities to achieve such a goal in more or less dirty ways using different hooks, see also GNU Emacs bug#15987. (I do not see the need to populate a hash table as an intermediate step, as it requires more coding efforts to keep such a hash table up to date when BBDB records get modified.) Yet I wish that, first of all, diary/calendar would officially support such a thing so that BBDB and org-mode need not hook into diary/calendar in some dirty ways. As a general strategy, with the new BBDB I want to avoid trying to be smarter than the main Emacs which BBDB builds upon. In my humble opinion, the old BBDB contained too many patches of that kind. 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. -- 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=84349351iu=/4140/ostg.clktrk ___ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/
Re: BBDB anniversaries in the calendar/diary
Roland Winkler wink...@gnu.org writes: On Sun Dec 1 2013 Eric Abrahamsen wrote: 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. There are various possibilities to achieve such a goal in more or less dirty ways using different hooks, see also GNU Emacs bug#15987. (I do not see the need to populate a hash table as an intermediate step, as it requires more coding efforts to keep such a hash table up to date when BBDB records get modified.) Yet I wish that, first of all, diary/calendar would officially support such a thing so that BBDB and org-mode need not hook into diary/calendar in some dirty ways. As a general strategy, with the new BBDB I want to avoid trying to be smarter than the main Emacs which BBDB builds upon. In my humble opinion, the old BBDB contained too many patches of that kind. Oh sure, I don't think this is a good solution by any means. It just presented itself as the shortest distance from here to there, at present. I hadn't read the conversation on the bug report. My 2 cents is that the calendar and the diary ought to be separate or at least separable things. I want to use the calendar; I have no need for the diary. Org mode users, in particular, will be using org to do what diary does, and my guess is most of us would like the bbdb-to-calendar integration to be separate from the diary. As you mention in the report, there's really no reason for an intermediate file. That's why `calendar-mark-visible-date' seemed like the best entry point: it's actually quite clean. But the rest of the code (including population of org-bbdb-anniv-hash) only works because org-bbdb loads diary-lib and does all the diary-related stuff for us. Does calendar/diary separation seem like a good idea? I could possibly chime in on the bug report... E -- 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=84349351iu=/4140/ostg.clktrk ___ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/