emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 6df1314: EUDC: Support BBDB >= 3


From: Thomas Fitzsimmons
Subject: [Emacs-diffs] master 6df1314: EUDC: Support BBDB >= 3
Date: Mon, 09 Mar 2015 01:16:33 +0000

branch: master
commit 6df13146cccc062c8bef9ed9c52827ec07c5885e
Author: Sergio Durigan Junior <address@hidden>
Commit: Thomas Fitzsimmons <address@hidden>

    EUDC: Support BBDB >= 3
    
    Fixes: bug#19678
    
    Co-authored-by: Thomas Fitzsimmons <address@hidden>
    * 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         |    7 +++++++
 lisp/net/eudcb-bbdb.el |   24 ++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5f26239..ed28911 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-06  Sergio Durigan Junior  <address@hidden>
+           Thomas Fitzsimmons  <address@hidden>
+
+       * 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-03-08  Dmitry Gutov  <address@hidden>
 
        * progmodes/ruby-mode.el (ruby-font-lock-keywords): Use
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 5be2bec..bd5d453 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -42,6 +42,24 @@
 (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)))))
+      'mail
+    field-symbol))
+
 (defvar eudc-bbdb-attributes-translation-alist
   '((name . lastname)
     (email . net)
@@ -85,7 +103,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
@@ -168,7 +188,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")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]