[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] Fix org-bbdb anniversaries to work with the new BBDB
From: |
Matt Lundin |
Subject: |
[O] [PATCH] Fix org-bbdb anniversaries to work with the new BBDB |
Date: |
Sat, 7 Apr 2012 07:21:57 -0500 |
* 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
- [O] [PATCH] Fix org-bbdb anniversaries to work with the new BBDB,
Matt Lundin <=