From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thomas Fitzsimmons Newsgroups: gmane.emacs.bugs Subject: bug#19678: [PATCH] EUDC does not support BBDB 3.x Date: Sun, 25 Jan 2015 18:49:56 -0500 Message-ID: References: <87mw57hhrd.fsf@sergiodj.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1422229882 3221 80.91.229.3 (25 Jan 2015 23:51:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2015 23:51:22 +0000 (UTC) Cc: 19678@debbugs.gnu.org To: Sergio Durigan Junior Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 26 00:51:17 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFWxX-0001ni-Ru for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jan 2015 00:51:16 +0100 Original-Received: from localhost ([::1]:39357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFWxX-0005O5-Co for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 18:51:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFWxN-0005N7-UY for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 18:51:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFWxK-0001ua-NG for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 18:51:05 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFWxK-0001uS-Jj for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 18:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YFWxJ-0004hr-VQ for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 18:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thomas Fitzsimmons Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Jan 2015 23:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19678 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 19678-submit@debbugs.gnu.org id=B19678.142222980918019 (code B ref 19678); Sun, 25 Jan 2015 23:51:01 +0000 Original-Received: (at 19678) by debbugs.gnu.org; 25 Jan 2015 23:50:09 +0000 Original-Received: from localhost ([127.0.0.1]:56327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFWwS-0004gY-9V for submit@debbugs.gnu.org; Sun, 25 Jan 2015 18:50:09 -0500 Original-Received: from mail-ie0-f178.google.com ([209.85.223.178]:53318) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFWwO-0004fu-1o for 19678@debbugs.gnu.org; Sun, 25 Jan 2015 18:50:05 -0500 Original-Received: by mail-ie0-f178.google.com with SMTP id rp18so5952376iec.9 for <19678@debbugs.gnu.org>; Sun, 25 Jan 2015 15:49:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=j2hQq1CvoauBAVSevvdDPbArXMp2TRhhoyI2UsENC+8=; b=XkfjAaZqt4VyG5VHz0bFfJJmQ3XWrfiIbtonCzqeWurduj9VurrzuPwNa/AvK5u/30 uN20biadYuYfBv9jtidxGxUYONC8btWtvTLGcAdLlXdh2dbDyChTTefBbaapbfP2R8ws E6oT0SqTRaI0bLLlEv37RvqVDEB6vioDUgJyPc6rt/WQTM7PtJJZKr2WcRw5g6D8l6Nw /fAprlvysrjPSgPRswjcmeevlgSb06I6iQQMwmKK0t9hn0f2RfgVUELS3K+DGi30njvu dWZyXeKOFp/0FaDU0N45LEC55p2FhrGUGCP4AP5E5S+z0n1v3oBYdUdLw4Lhfj2fhNaE bm7w== X-Gm-Message-State: ALoCoQmiBorKwAmSBqqSFIWm5vgixp84zdcz4GUAxFoEoiCQGl4WCsb9x9+bPRhZc6pxPNGq/suh X-Received: by 10.50.25.166 with SMTP id d6mr13553896igg.41.1422229798331; Sun, 25 Jan 2015 15:49:58 -0800 (PST) Original-Received: from hp-dv5t (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by mx.google.com with ESMTPSA id v39sm5036701iov.17.2015.01.25.15.49.57 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 25 Jan 2015 15:49:57 -0800 (PST) In-Reply-To: <87mw57hhrd.fsf@sergiodj.net> (Sergio Durigan Junior's message of "Sat, 24 Jan 2015 18:37:58 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:98733 Archived-At: --=-=-= Content-Type: text/plain Sergio Durigan Junior writes: > This bug was opened due to a request made at: > > > > As explained at: > > > > With the release of BBDB 3.x, EUDC needs adjustments to properly work > with it. Actually, after some investigation, I noticed that the only > adjustment was to replace the occurrences of 'net' by 'mail' in the > code. The second link above contains a patch that does that, but Thomas > Fitzsimmons correctly noted (in the first link) that the patch breaks > compatibility with BBDB 2.x. > > The following patch is a first attempt to implement the support for both > BBDB 2.x and 3.x. Can you see if the attached patch works for you? It works for me, introduces minimal changes and allows for upgrading BBDB 2 to BBDB 3 without restarting Emacs. The defvar change in your patch concerns me because it will miss if the BBDB version changes after the variable is first assigned. I'm also going to experiment with eudc-export which also may need to be updated for BBDB 3 handling. Longer term I hope to work toward bundling BBDB in Emacs which would eliminate the need to support multiple versions. Thomas --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-EUDC-Support-BBDB-3.patch >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 --=-=-=--