From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: [PATCH] Fix org-bbdb anniversaries to work with the new BBDB Date: Sat, 7 Apr 2012 07:21:57 -0500 Message-ID: <87bon3raqo.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGUgU-0007Zh-Uz for emacs-orgmode@gnu.org; Sat, 07 Apr 2012 08:24:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGUgT-0004jS-55 for emacs-orgmode@gnu.org; Sat, 07 Apr 2012 08:24:02 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGUgS-0004jO-Sf for emacs-orgmode@gnu.org; Sat, 07 Apr 2012 08:24:01 -0400 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id B5D1A220C7 for ; Sat, 7 Apr 2012 08:23:59 -0400 (EDT) Received: from archbook (c-67-174-95-44.hsd1.il.comcast.net [67.174.95.44]) by mail.messagingengine.com (Postfix) with ESMTPSA id 249514825F4 for ; Sat, 7 Apr 2012 08:23:58 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode * lisp/org-bbdb.el: (org-bbdb-anniv-extract-date) (org-bbdb-make-anniv-hash) Fix org-bbdb anniversary functionality to accommodate bbdb 3.x. There are two major changes in bbdb 3.x that need to be taken into account. The first is that bbdb-split reverses the order of its parameters in 3.x. The second is that bbdb-record-getprop is replaced by bbdb-record-note in 3.x. --- lisp/org-bbdb.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el index ef53a35..f320d56 100644 --- a/lisp/org-bbdb.el +++ b/lisp/org-bbdb.el @@ -273,7 +273,7 @@ italicized, in all other cases it is left unchanged." "Convert YYYY-MM-DD to (month date year). Argument TIME-STR is the value retrieved from BBDB. If YYYY- is omitted it will be considered unknown." - (multiple-value-bind (a b c) (values-list (bbdb-split time-str "-")) + (multiple-value-bind (a b c) (values-list (org-split-string time-str "-")) (if (eq c nil) (list (string-to-number a) (string-to-number b) @@ -300,13 +300,19 @@ The hash table is created on first use.") (defun org-bbdb-make-anniv-hash () "Create a hash with anniversaries extracted from BBDB, for fast access. The anniversaries are assumed to be stored `org-bbdb-anniversary-field'." - - (let (split tmp annivs) + (let ((old-bbdb (fboundp 'bbdb-record-getprop)) + split tmp annivs) (clrhash org-bbdb-anniv-hash) (dolist (rec (bbdb-records)) - (when (setq annivs (bbdb-record-getprop - rec org-bbdb-anniversary-field)) - (setq annivs (bbdb-split annivs "\n")) + (when (setq annivs (if old-bbdb + (bbdb-record-getprop + rec org-bbdb-anniversary-field) + (bbdb-record-note + rec org-bbdb-anniversary-field))) + (setq annivs (if old-bbdb + (bbdb-split annivs "\n") + ;; parameter order is reversed in new bbdb + (bbdb-split "\n" annivs))) (while annivs (setq split (org-bbdb-anniv-split (pop annivs))) (multiple-value-bind (m d y) -- 1.7.10