1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-23 07:18:53 +00:00

org-bbdb: Check for BBDB version depending on available functions

* org-bbdb.el (org-bbdb-old): Replace `defvar' after loading 'bbdb to
check for old or new version by a check for the required function in
`org-bbdb-open' and `org-bbdb-store-link'.
(org-bbdb-store-link, org-bbdb-open): Check which version of bbdb is
to be used.

This is a follow up of ddf4f1e7a9.

Instead of depending on the loading of bbdb we do a check for the
required function in `org-bbdb-open' and `org-bbdb-store-link'.
This commit is contained in:
David Maus 2012-03-02 17:28:17 +01:00
parent 5bcf0c16da
commit e1ac0cb9cd

View File

@ -118,10 +118,6 @@
(defvar date) ;; dynamically scoped from Org
;; Support for version 2.35
(eval-after-load 'bbdb
'(defvar org-bbdb-old (fboundp 'bbdb-record-get-field-internal)))
;; Customization
(defgroup org-bbdb-anniversaries nil
@ -201,7 +197,7 @@ date year)."
;; This is BBDB, we make this link!
(let* ((rec (bbdb-current-record))
(name (bbdb-record-name rec))
(company (if org-bbdb-old
(company (if (fboundp 'bbdb-record-getprop)
(bbdb-record-getprop rec 'company)
(car (bbdb-record-get-field rec 'organization))))
(link (org-make-link "bbdb:" name)))
@ -222,10 +218,10 @@ italicized, in all other cases it is left unchanged."
(defun org-bbdb-open (name)
"Follow a BBDB link to NAME."
(require 'bbdb)
(require 'bbdb-com)
(let ((inhibit-redisplay (not debug-on-error))
(bbdb-electric-p nil))
(if org-bbdb-old
(if (fboundp 'bbdb-name)
(org-bbdb-open-old)
(org-bbdb-open-new))))