* [PATCH] Fix org-bbdb anniversaries to work with the new BBDB
@ 2012-04-07 12:21 Matt Lundin
2012-04-09 10:53 ` Bastien
0 siblings, 1 reply; 2+ messages in thread
From: Matt Lundin @ 2012-04-07 12:21 UTC (permalink / raw)
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix org-bbdb anniversaries to work with the new BBDB
2012-04-07 12:21 [PATCH] Fix org-bbdb anniversaries to work with the new BBDB Matt Lundin
@ 2012-04-09 10:53 ` Bastien
0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2012-04-09 10:53 UTC (permalink / raw)
To: Matt Lundin; +Cc: Org Mode
Hi Matt,
Matt Lundin <mdl@imapmail.org> writes:
> * 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.
Applied, thanks.
Ps: I slightly edited the changelog entry to make it look like a
changelog produced by `C-x 4 a'.
--
Bastien
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-09 10:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-07 12:21 [PATCH] Fix org-bbdb anniversaries to work with the new BBDB Matt Lundin
2012-04-09 10:53 ` Bastien
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.