diff options
| author | Thomas Fitzsimmons | 2015-11-22 17:30:50 -0500 |
|---|---|---|
| committer | Thomas Fitzsimmons | 2015-11-22 20:56:22 -0500 |
| commit | 43d2e55fc17336b33a1581adf60179ff07ad580c (patch) | |
| tree | 9c99dd014cc974ca3d2032656dee12a5ad92e63d | |
| parent | 40ed767ba0a35dbaeee6bdbd85a108d88a982b1a (diff) | |
| download | emacs-43d2e55fc17336b33a1581adf60179ff07ad580c.tar.gz emacs-43d2e55fc17336b33a1581adf60179ff07ad580c.zip | |
Add BBDB 3 support for EUDC export
* 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)
| -rw-r--r-- | lisp/net/eudc-export.el | 19 | ||||
| -rw-r--r-- | lisp/net/eudc.el | 12 | ||||
| -rw-r--r-- | lisp/net/eudcb-bbdb.el | 10 |
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." | |||
| 86 | (cons (car mapping) value)))) | 86 | (cons (car mapping) value)))) |
| 87 | conversion-alist))) | 87 | conversion-alist))) |
| 88 | (setq bbdb-notes (delq nil bbdb-notes)) | 88 | (setq bbdb-notes (delq nil bbdb-notes)) |
| 89 | (setq bbdb-record (bbdb-create-internal bbdb-name | 89 | (setq bbdb-record (bbdb-create-internal |
| 90 | bbdb-company | 90 | bbdb-name |
| 91 | bbdb-net | 91 | ,@(when (eudc--using-bbdb-3-or-newer-p) |
| 92 | bbdb-address | 92 | '(nil |
| 93 | bbdb-phones | 93 | nil)) |
| 94 | bbdb-notes)) | 94 | bbdb-company |
| 95 | bbdb-net | ||
| 96 | ,@(if (eudc--using-bbdb-3-or-newer-p) | ||
| 97 | '(bbdb-phones | ||
| 98 | bbdb-address) | ||
| 99 | '(bbdb-address | ||
| 100 | bbdb-phones)) | ||
| 101 | bbdb-notes)) | ||
| 95 | (or silent | 102 | (or silent |
| 96 | (bbdb-display-records (list bbdb-record)))))) | 103 | (bbdb-display-records (list bbdb-record)))))) |
| 97 | 104 | ||
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 @@ | |||
| 107 | ;; attribute name | 107 | ;; attribute name |
| 108 | (defvar eudc-protocol-has-default-query-attributes nil) | 108 | (defvar eudc-protocol-has-default-query-attributes nil) |
| 109 | 109 | ||
| 110 | (defvar bbdb-version) | ||
| 111 | |||
| 112 | (defun eudc--using-bbdb-3-or-newer-p () | ||
| 113 | "Return non-nil if BBDB version is 3 or greater." | ||
| 114 | (or | ||
| 115 | ;; MELPA versions of BBDB may have a bad package version, but | ||
| 116 | ;; they're all version 3 or later. | ||
| 117 | (equal bbdb-version "@PACKAGE_VERSION@") | ||
| 118 | ;; Development versions of BBDB can have the format "X.YZ devo". | ||
| 119 | ;; Split the string just in case. | ||
| 120 | (version<= "3" (car (split-string bbdb-version))))) | ||
| 121 | |||
| 110 | (defun eudc-plist-member (plist prop) | 122 | (defun eudc-plist-member (plist prop) |
| 111 | "Return t if PROP has a value specified in PLIST." | 123 | "Return t if PROP has a value specified in PLIST." |
| 112 | (if (not (= 0 (% (length plist) 2))) | 124 | (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 @@ | |||
| 42 | (defvar eudc-bbdb-current-query nil) | 42 | (defvar eudc-bbdb-current-query nil) |
| 43 | (defvar eudc-bbdb-current-return-attributes nil) | 43 | (defvar eudc-bbdb-current-return-attributes nil) |
| 44 | 44 | ||
| 45 | (defvar bbdb-version) | ||
| 46 | |||
| 47 | (defun eudc-bbdb-field (field-symbol) | 45 | (defun eudc-bbdb-field (field-symbol) |
| 48 | "Convert FIELD-SYMBOL so that it is recognized by the current BBDB version. | 46 | "Convert FIELD-SYMBOL so that it is recognized by the current BBDB version. |
| 49 | BBDB < 3 used `net'; BBDB >= 3 uses `mail'." | 47 | BBDB < 3 used `net'; BBDB >= 3 uses `mail'." |
| 50 | ;; This just-in-time translation permits upgrading from BBDB 2 to | 48 | ;; This just-in-time translation permits upgrading from BBDB 2 to |
| 51 | ;; BBDB 3 without restarting Emacs. | 49 | ;; BBDB 3 without restarting Emacs. |
| 52 | (if (and (eq field-symbol 'net) | 50 | (if (and (eq field-symbol 'net) |
| 53 | (or | 51 | (eudc--using-bbdb-3-or-newer-p)) |
| 54 | ;; MELPA versions of BBDB may have a bad package version, | ||
| 55 | ;; but they're all version 3 or later. | ||
| 56 | (equal bbdb-version "@PACKAGE_VERSION@") | ||
| 57 | ;; Development versions of BBDB can have the format "X.YZ | ||
| 58 | ;; devo". Split the string just in case. | ||
| 59 | (version<= "3" (car (split-string bbdb-version))))) | ||
| 60 | 52 | ||
| 61 | field-symbol)) | 53 | field-symbol)) |
| 62 | 54 | ||