Support BBDB >= 3 (EUDC) (#1261668)

Signed-off-by: Petr Hracek <phracek@redhat.com>
This commit is contained in:
Petr Hracek 2015-09-11 17:35:44 +02:00
parent 61c3d58e03
commit ec3c8de479
2 changed files with 55 additions and 1 deletions

49
emacs-bbdb.patch Normal file
View File

@ -0,0 +1,49 @@
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 0400e5b..582ecb5 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -41,6 +41,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)
@@ -84,7 +102,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 +187,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")))

View File

@ -5,7 +5,7 @@ Summary: GNU Emacs text editor
Name: emacs Name: emacs
Epoch: 1 Epoch: 1
Version: 24.5 Version: 24.5
Release: 5%{?dist} Release: 6%{?dist}
License: GPLv3+ and CC0-1.0 License: GPLv3+ and CC0-1.0
URL: http://www.gnu.org/software/emacs/ URL: http://www.gnu.org/software/emacs/
Group: Applications/Editors Group: Applications/Editors
@ -28,6 +28,7 @@ Patch1: emacs-spellchecker.patch
Patch2: emacs-pdf-default.patch Patch2: emacs-pdf-default.patch
Patch3: emacs-grep-deprecated.patch Patch3: emacs-grep-deprecated.patch
Patch4: emacs-system-crypto-policies.patch Patch4: emacs-system-crypto-policies.patch
Patch5: emacs-bbdb.patch
BuildRequires: atk-devel BuildRequires: atk-devel
BuildRequires: cairo-devel BuildRequires: cairo-devel
@ -190,6 +191,7 @@ packages that add functionality to Emacs.
%patch2 -p1 -b .pdf-default.patch %patch2 -p1 -b .pdf-default.patch
%patch3 -p1 -b .grep-deprecated %patch3 -p1 -b .grep-deprecated
%patch4 -p1 -b .system-crypto-policies %patch4 -p1 -b .system-crypto-policies
%patch5 -p1 -b .bbdb
autoconf autoconf
# We prefer our emacs.desktop file # We prefer our emacs.desktop file
@ -484,6 +486,9 @@ update-desktop-database &> /dev/null || :
%dir %{_datadir}/emacs/site-lisp/site-start.d %dir %{_datadir}/emacs/site-lisp/site-start.d
%changelog %changelog
* Fri Sep 11 2015 Petr Hracek <phracek@redhat.com> - 1:24.5-6
- Support BBDB >= 3 (EUDC) (#1261668)
* Wed Jun 17 2015 Petr Hracek <phracek@redhat.com> - 1:24.5-5 * Wed Jun 17 2015 Petr Hracek <phracek@redhat.com> - 1:24.5-5
- game and Trademark problem (#1231676) - game and Trademark problem (#1231676)