]> git.eshelyaron.com Git - emacs.git/commitdiff
Add BBDB 3 support for EUDC export
authorThomas Fitzsimmons <fitzsim@fitzsim.org>
Sun, 22 Nov 2015 22:30:50 +0000 (17:30 -0500)
committerThomas Fitzsimmons <fitzsim@fitzsim.org>
Mon, 23 Nov 2015 01:56:22 +0000 (20:56 -0500)
* eudc.el: Add bbdb-version defvar.
(eudc--using-bbdb-3-or-newer-p): New function.
* eudc-export.el (eudc-create-bbdb-record): Add support for
bbdb-create-internal argument list changes introduced in BBDB 3.
* eudcb-bbdb.el: Remove bbdb-version defvar.
(eudc-bbdb-field): Call eudc--using-bbdb-3-or-newer-p.
(Bug#21971)

lisp/net/eudc-export.el
lisp/net/eudc.el
lisp/net/eudcb-bbdb.el

index c60911ff0c56d2702688150f67cf949032206e99..a65f555f89e58b7ce4d127279536a1d394d1698e 100644 (file)
@@ -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))))))
 
index 7280d9d26252941b07680ddf0b776d33d5616372..25a26bdf0298c4a5b40971cec48730eb23a5dc3d 100644 (file)
 ;; 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)))
index 0545304b4a3f500a4e1df56256d7775082ae103c..1972fc1939a9001dd00bc4ab54934273da51b626 100644 (file)
 (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))