>From 34dbaf966d2875c1f129f35c9866122f88e0ac16 Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Sun, 25 Jan 2015 01:32:52 -0500 Subject: [PATCH 1/2] EUDC: Support BBDB >= 3 * 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. --- lisp/ChangeLog | 6 ++++++ lisp/net/eudcb-bbdb.el | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70293af..e26e028 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2015-01-25 Thomas Fitzsimmons + + * 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. + 2015-01-25 Stefan Monnier * emacs-lisp/cl-generic.el (cl--generic-no-next-method-function): New fun. diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el index 0400e5b..7aed542 100644 --- a/lisp/net/eudcb-bbdb.el +++ b/lisp/net/eudcb-bbdb.el @@ -41,6 +41,16 @@ (defvar eudc-bbdb-current-query nil) (defvar eudc-bbdb-current-return-attributes nil) +(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) + (version<= "3" bbdb-version)) + 'mail + field-symbol)) + (defvar eudc-bbdb-attributes-translation-alist '((name . lastname) (email . net) @@ -84,7 +94,9 @@ (progn (setq bbdb-val (eval (list (intern (concat "bbdb-record-" - (symbol-name attr))) + (symbol-name + (eudc-bbdb-field + attr)))) 'record))) (if (listp bbdb-val) (if eudc-bbdb-enable-substring-matches @@ -167,7 +179,7 @@ The record is filtered according to `eudc-bbdb-current-return-attributes'" (setq val (eval (list (intern (concat "bbdb-record-" - (symbol-name attr))) + (symbol-name (eudc-bbdb-field attr)))) 'record)))) (t (error "Unknown BBDB attribute"))) -- 1.8.1.4