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#21971: 25.1.50; EUDC conversion to BBDB 3 incompatibility Date: Sun, 22 Nov 2015 11:36:37 -0500 Message-ID: References: <82egfjs9v1.fsf@jobim-via-gmail.com> <82610ucc5p.fsf@jobim-via-gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1448210252 346 80.91.229.3 (22 Nov 2015 16:37:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Nov 2015 16:37:32 +0000 (UTC) Cc: 21971@debbugs.gnu.org To: George McNinch Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 22 17:37:20 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 1a0XdV-00040n-Ik for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Nov 2015 17:37:09 +0100 Original-Received: from localhost ([::1]:56619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0XdV-0000jy-8x for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Nov 2015 11:37:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0XdS-0000j2-2i for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 11:37:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0XdO-0003b2-Pt for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 11:37:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0XdO-0003as-I2 for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 11:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1a0XdO-0003v3-66 for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 11:37: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, 22 Nov 2015 16:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21971 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21971-submit@debbugs.gnu.org id=B21971.144821022015057 (code B ref 21971); Sun, 22 Nov 2015 16:37:02 +0000 Original-Received: (at 21971) by debbugs.gnu.org; 22 Nov 2015 16:37:00 +0000 Original-Received: from localhost ([127.0.0.1]:48382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a0XdL-0003un-76 for submit@debbugs.gnu.org; Sun, 22 Nov 2015 11:36:59 -0500 Original-Received: from mail-ig0-f179.google.com ([209.85.213.179]:37738) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a0Xd1-0003uG-Fp for 21971@debbugs.gnu.org; Sun, 22 Nov 2015 11:36:58 -0500 Original-Received: by igcto18 with SMTP id to18so42435719igc.0 for <21971@debbugs.gnu.org>; Sun, 22 Nov 2015 08:36:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=Se1HauNpZzDI5zxBfi0+/A/UZjh0VJ+ggjE9vNgxRn0=; b=bdp3j7mW/r1wCnJDdX6ePpy7LVMR2zz5frJEJun+Fet1OE2/qc21wG4Tf1FEu+WSaF BZKXRdVwvtL9VnsYoD/SJS1vBl8bhLvbctqSa1CxiyBf4XCSg6nRRIK8dfWIo3ku+5+m zdIDYIUoQl08pf51U0K96Ie0zaHbsUYK994ARvGYPLm0BPlOPL2O+53+rrI4J1wjxT4k Ldr0n1pfd/owqkh1rVNY5f+7qN083WNZP+Wh7dVhiGQrT4CxbQMR+H2ggw7sNSjhaprT 24frzr0ZnrE2pmB7yc9+gPEmBLAl4pUedTHGxq3fh2En3AIfBMe7CdoaAcPWrv/N4ud1 /D7A== 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=Se1HauNpZzDI5zxBfi0+/A/UZjh0VJ+ggjE9vNgxRn0=; b=euD54S+Vh//zfQWEPRdo/lR0ZdllS5fxCL5x/AAWCGsqcmh0csWBS4SxYbDyOy026K b3NSi8zmGlhlMbFPbLW3nPkMvi9Zj6qs9SXyskPemOH5gwi0ah6FcFs2o7XBA5/CGyLx DPSmfUSSi11KHQ1ZTyJb/a/pVx0dj/EDk1wFmgNDIu2OU1RQHkDmEPA/IbdamWc859/l TtnKKW0veuknxSS9ovnfVbO36qY47GduERUnKqY6GSyP6o96GSwkAZURQbMkDbtOkjfE WrIACR35JeQ94Qxuno08abGLlG08K+ruMaDAm7HeqtPB+ivTUZsg7CElAXk17MjFGoWp Qchg== X-Gm-Message-State: ALoCoQl/gdlgmILgyWWpeyyifAox2cotrTl7A8JD4rr0+UGWGwvkcXCs1cSJtWSRHp8x1u4o+rZ9 X-Received: by 10.50.155.73 with SMTP id vu9mr10798091igb.89.1448210198780; Sun, 22 Nov 2015 08:36:38 -0800 (PST) Original-Received: from hp-dv5t (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id b2sm3584956igx.1.2015.11.22.08.36.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Nov 2015 08:36:38 -0800 (PST) In-Reply-To: <82610ucc5p.fsf@jobim-via-gmail.com> (George McNinch's message of "Sun, 22 Nov 2015 10:00:02 -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: 208.118.235.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:109070 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable George McNinch writes: > Hi Thomas, > > TF> With your eudc-ldap-bbdb-conversion-alist workaround still > TF> enabled, can you try the attached patch to see if it fixes > TF> exporting for you? > > Indeed, this works fine for me; thanks! > > >> Note also that the setting of eudc-ldap-bbdb-conversion-alist I > >> made above isn't quite the original value. If I instead use the > >> original value, e.g. by instead using the original value > >>=20 > >> [which amounts to: > >>=20 > >> (setq eudc-ldap-bbdb-conversion-alist `((name . cn) (net . mail) > >> (address eudc-bbdbify-address postaladdress "Address") (phone > >> (eudc-bbdbify-phone telephonenumber "Phone"))) > >>=20 > >>=20 > >> in the initialization of EUDC], > >>=20 > >> then when I press "b" on a record in the *Directory Query > >> Results* buffer, I get the error > >>=20 > >> eudc-bbdbify-phone: Symbol=E2=80=99s function definition is void: > >> bbdb-parse-phone-number > > TF> OK, this seems like a separate issue. I haven't investigated it > TF> yet. > > Right; should I have made a separate report, or is this OK?=20=20 It's fine, we can work on it here. > -------------------------------------------- > By the way: > > I wonder: if bbdb really now uses "mail" instead of "net", I'd think > that (?) that eudc-ldap-bbdb-conversion-alist should instead read: > > (setq eudc-ldap-bbdb-conversion-alist > `((name . cn) > (mail . mail) > (address eudc-bbdbify-address postaladdress "Address"))) > > But that doesn't seem to work (I tried... I get then BBDB record with > *no* mail field at all). > > In general, I find it difficult to work out what can be used in that > alist. E.g. it seems that there is a key symbol ou for the record > passed to eudc-create-bbdb-record. > > So I tried adding the pair > > (Organizations . ou) > > to that alist, but it doens't seem to populate the "right part of the > BBDB record" - in fact, the BBDB record gets a new line with an > Organizations field, but it makes the BBDB unhappy (it eventually > complains of an "illegal field" or something). I'd hoped to populate the > bit that shows up to the right of the name when displaying the BBDB > record, which I thought was called "Organizations". > > I also tried (organization . ou) and (company . ou) and maybe a few > others, but nothing seemed to work and guessing doesn't seem so healthy, > and looking at the code in eudc-export.el doesn't seem like > > Well, this is a distraction, and only tangentially related to the patch, > but it does point out that it'd be nice to have a clearer definition of > the fields on both sides of this conversion...! Can you remove your eudc-ldap-bbdb-conversion-alist customization and try the attached patch? I think it will fix both the phone parsing and organization missing issues. I wouldn't worry about 'net unless you're customizing it directly. It's a change and I left the old 'net as the customization entry point, but it will get converted to 'mail depending on which version of BBDB is in use. Thomas --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Improve-EUDC-to-BBDB-3-export.patch >From 25b742df574fc9ae8340a37409fc72ec2f40574b Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Sun, 22 Nov 2015 11:29:13 -0500 Subject: [PATCH] Improve EUDC to BBDB 3 export * eudc-vars.el (eudc-ldap-bbdb-conversion-alist): Change phone entry to single item. Add company conversion. * eudc-export.el (eudc-bbdbify-company): New function. (eudc-bbdbify-phone): Add BBDB 3 support. (bug#21971) --- lisp/net/eudc-export.el | 8 +++++++- lisp/net/eudc-vars.el | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el index a65f555..f91f4ae 100644 --- a/lisp/net/eudc-export.el +++ b/lisp/net/eudc-export.el @@ -169,6 +169,10 @@ eudc-bbdbify-address (string &optional number-type)) (declare-function bbdb-string-trim "ext:bbdb" (string)) +(defun eudc-bbdbify-company (&rest organizations) + "Return ORGANIZATIONS as a list compatible with BBDB." + organizations) + (defun eudc-bbdbify-phone (phone location) "Parse PHONE into a vector compatible with BBDB. PHONE is either a string supposedly containing a phone number or @@ -179,7 +183,9 @@ eudc-bbdbify-phone ((stringp phone) (let (phone-list) (condition-case err - (setq phone-list (bbdb-parse-phone-number phone)) + (setq phone-list (if (eudc--using-bbdb-3-or-newer-p) + (bbdb-parse-phone phone) + (bbdb-parse-phone-number phone))) (error (if (string= "phone number unparsable." (cadr err)) (if (not (y-or-n-p (format "BBDB claims %S to be unparsable--insert anyway? " phone))) diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el index 8cffa8e..a08d175 100644 --- a/lisp/net/eudc-vars.el +++ b/lisp/net/eudc-vars.el @@ -369,7 +369,8 @@ eudc-ldap-bbdb-conversion-alist '((name . cn) (net . mail) (address . (eudc-bbdbify-address postaladdress "Address")) - (phone . ((eudc-bbdbify-phone telephonenumber "Phone")))) + (phone . (eudc-bbdbify-phone telephonenumber "Phone")) + (company . (eudc-bbdbify-company o))) "A mapping from BBDB to LDAP attributes. This is a list of cons cells (BBDB-FIELD . SPEC-OR-LIST) where BBDB-FIELD is the name of a field that must be defined in your BBDB -- 1.8.3.1 --=-=-=--