summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/net/eudc-export.el19
-rw-r--r--lisp/net/eudc.el12
-rw-r--r--lisp/net/eudcb-bbdb.el10
3 files changed, 26 insertions, 15 deletions
diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el
index c60911ff0c5..a65f555f89e 100644
--- a/lisp/net/eudc-export.el
+++ b/lisp/net/eudc-export.el
@@ -86,12 +86,19 @@ If SILENT is non-nil then the created BBDB record is not displayed."
(cons (car mapping) value))))
conversion-alist)))
(setq bbdb-notes (delq nil bbdb-notes))
- (setq bbdb-record (bbdb-create-internal bbdb-name
- bbdb-company
- bbdb-net
- bbdb-address
- bbdb-phones
- bbdb-notes))
+ (setq bbdb-record (bbdb-create-internal
+ bbdb-name
+ ,@(when (eudc--using-bbdb-3-or-newer-p)
+ '(nil
+ nil))
+ bbdb-company
+ bbdb-net
+ ,@(if (eudc--using-bbdb-3-or-newer-p)
+ '(bbdb-phones
+ bbdb-address)
+ '(bbdb-address
+ bbdb-phones))
+ bbdb-notes))
(or silent
(bbdb-display-records (list bbdb-record))))))
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 7280d9d2625..25a26bdf029 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -107,6 +107,18 @@
;; attribute name
(defvar eudc-protocol-has-default-query-attributes nil)
+(defvar bbdb-version)
+
+(defun eudc--using-bbdb-3-or-newer-p ()
+ "Return non-nil if BBDB version is 3 or greater."
+ (or
+ ;; MELPA versions of BBDB may have a bad package version, but
+ ;; they're all version 3 or later.
+ (equal bbdb-version "@PACKAGE_VERSION@")
+ ;; Development versions of BBDB can have the format "X.YZ devo".
+ ;; Split the string just in case.
+ (version<= "3" (car (split-string bbdb-version)))))
+
(defun eudc-plist-member (plist prop)
"Return t if PROP has a value specified in PLIST."
(if (not (= 0 (% (length plist) 2)))
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 0545304b4a3..1972fc1939a 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -42,21 +42,13 @@
(defvar eudc-bbdb-current-query nil)
(defvar eudc-bbdb-current-return-attributes nil)
-(defvar bbdb-version)
-
(defun eudc-bbdb-field (field-symbol)
"Convert FIELD-SYMBOL so that it is recognized by the current BBDB version.
BBDB < 3 used `net'; BBDB >= 3 uses `mail'."
;; This just-in-time translation permits upgrading from BBDB 2 to
;; BBDB 3 without restarting Emacs.
(if (and (eq field-symbol 'net)
- (or
- ;; MELPA versions of BBDB may have a bad package version,
- ;; but they're all version 3 or later.
- (equal bbdb-version "@PACKAGE_VERSION@")
- ;; Development versions of BBDB can have the format "X.YZ
- ;; devo". Split the string just in case.
- (version<= "3" (car (split-string bbdb-version)))))
+ (eudc--using-bbdb-3-or-newer-p))
'mail
field-symbol))