mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-28 10:56:57 +00:00
Fix org-bbdb anniversaries to work with the new BBDB
* 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.
This commit is contained in:
parent
14e4d7ece9
commit
76503ed1b4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user