diff options
| author | Sergio Durigan Junior | 2015-03-06 03:18:36 -0500 |
|---|---|---|
| committer | Thomas Fitzsimmons | 2015-03-08 21:12:11 -0400 |
| commit | 6df13146cccc062c8bef9ed9c52827ec07c5885e (patch) | |
| tree | 71adaa60f16854f07a9c94f0101fda3bc60cea99 | |
| parent | 6b134bcba9de5605086ee9382c0be13174480cac (diff) | |
| download | emacs-6df13146cccc062c8bef9ed9c52827ec07c5885e.tar.gz emacs-6df13146cccc062c8bef9ed9c52827ec07c5885e.zip | |
EUDC: Support BBDB >= 3
Fixes: bug#19678
Co-authored-by: Thomas Fitzsimmons <fitzsim@fitzsim.org>
* net/eudcb-bbdb.el (eudc-bbdb-field): New function.
(eudc-bbdb-filter-non-matching-record): Call eudc-bbdb-field.
(eudc-bbdb-format-record-as-result): Likewise.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/net/eudcb-bbdb.el | 24 |
2 files changed, 29 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5f26239ecdc..ed28911497a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2015-03-06 Sergio Durigan Junior <sergiodj@sergiodj.net> | ||
| 2 | Thomas Fitzsimmons <fitzsim@fitzsim.org> | ||
| 3 | |||
| 4 | * net/eudcb-bbdb.el (eudc-bbdb-field): New function. | ||
| 5 | (eudc-bbdb-filter-non-matching-record): Call eudc-bbdb-field. | ||
| 6 | (eudc-bbdb-format-record-as-result): Likewise. | ||
| 7 | |||
| 1 | 2015-03-08 Dmitry Gutov <dgutov@yandex.ru> | 8 | 2015-03-08 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 9 | ||
| 3 | * progmodes/ruby-mode.el (ruby-font-lock-keywords): Use | 10 | * progmodes/ruby-mode.el (ruby-font-lock-keywords): Use |
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el index 5be2bec0c5d..bd5d4536aab 100644 --- a/lisp/net/eudcb-bbdb.el +++ b/lisp/net/eudcb-bbdb.el | |||
| @@ -42,6 +42,24 @@ | |||
| 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) | ||
| 48 | "Convert FIELD-SYMBOL so that it is recognized by the current BBDB version. | ||
| 49 | BBDB < 3 used `net'; BBDB >= 3 uses `mail'." | ||
| 50 | ;; This just-in-time translation permits upgrading from BBDB 2 to | ||
| 51 | ;; BBDB 3 without restarting Emacs. | ||
| 52 | (if (and (eq field-symbol 'net) | ||
| 53 | (or | ||
| 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 | |||
| 61 | field-symbol)) | ||
| 62 | |||
| 45 | (defvar eudc-bbdb-attributes-translation-alist | 63 | (defvar eudc-bbdb-attributes-translation-alist |
| 46 | '((name . lastname) | 64 | '((name . lastname) |
| 47 | (email . net) | 65 | (email . net) |
| @@ -85,7 +103,9 @@ | |||
| 85 | (progn | 103 | (progn |
| 86 | (setq bbdb-val | 104 | (setq bbdb-val |
| 87 | (eval (list (intern (concat "bbdb-record-" | 105 | (eval (list (intern (concat "bbdb-record-" |
| 88 | (symbol-name attr))) | 106 | (symbol-name |
| 107 | (eudc-bbdb-field | ||
| 108 | attr)))) | ||
| 89 | 'record))) | 109 | 'record))) |
| 90 | (if (listp bbdb-val) | 110 | (if (listp bbdb-val) |
| 91 | (if eudc-bbdb-enable-substring-matches | 111 | (if eudc-bbdb-enable-substring-matches |
| @@ -168,7 +188,7 @@ The record is filtered according to `eudc-bbdb-current-return-attributes'" | |||
| 168 | (setq val (eval | 188 | (setq val (eval |
| 169 | (list (intern | 189 | (list (intern |
| 170 | (concat "bbdb-record-" | 190 | (concat "bbdb-record-" |
| 171 | (symbol-name attr))) | 191 | (symbol-name (eudc-bbdb-field attr)))) |
| 172 | 'record)))) | 192 | 'record)))) |
| 173 | (t | 193 | (t |
| 174 | (error "Unknown BBDB attribute"))) | 194 | (error "Unknown BBDB attribute"))) |