unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
To: George McNinch <gmcninch@gmail.com>
Cc: 21971@debbugs.gnu.org
Subject: bug#21971: 25.1.50; EUDC conversion to BBDB 3 incompatibility
Date: Sat, 21 Nov 2015 21:44:05 -0500	[thread overview]
Message-ID: <m3610u92iy.fsf@fitzsim.org> (raw)
In-Reply-To: <82egfjs9v1.fsf@jobim-via-gmail.com> (George McNinch's message of "Sat, 21 Nov 2015 09:30:42 -0500")

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

Hi George,

George McNinch <gmcninch@gmail.com> writes:

[...]

> In fact, a record *has* been inserted into the bbdb; in this case it
> looks like
>
> ["George" "McNinch" nil "George.McNinch@tufts.edu" nil nil nil nil ((creation-date . "2015-11-21 14:13:29 +0000") (timestamp . "2015-11-21 14:13:29 +0000")) nil]
>
> (assuming McNinch was not already in the bbdb, of course).
>
> This record seems "mangled" from the point-of-view of BBDB3 - the email
> address should be "in a list" inside this record-vector. Perhaps other
> things are amiss, as well.

Thank you for the detailed description of how to replicate the issue.

> 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
>
> [which amounts to:
>
>   (setq eudc-ldap-bbdb-conversion-alist
> 	`((name . cn)
> 	  (net . mail)
> 	  (address eudc-bbdbify-address postaladdress "Address")
> 	  (phone
> 	   (eudc-bbdbify-phone telephonenumber "Phone")))
>
>
> in the initialization of EUDC],
>
> then when I press "b" on a record
> in the *Directory Query Results* buffer, I get the error
>
> eudc-bbdbify-phone: Symbol’s function definition is void:
> bbdb-parse-phone-number

OK, this seems like a separate issue.  I haven't investigated it yet.

With your eudc-ldap-bbdb-conversion-alist workaround still enabled, can
you try the attached patch to see if it fixes exporting for you?

Thanks,
Thomas


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-BBDB-3-support-for-EUDC-export.patch --]
[-- Type: text/x-patch, Size: 3451 bytes --]

From 3a4870a3076467c8465df9ba5dd0646acf1d6fd0 Mon Sep 17 00:00:00 2001
From: Thomas Fitzsimmons <tfitzsim@tfitzsim-lnx2.cisco.com>
Date: Sat, 21 Nov 2015 21:24:27 -0500
Subject: [PATCH] Add BBDB 3 support for EUDC export

* eudc.el: Add bbdb-version defvar.
(eudc--using-bbdb-3-or-newer-p): New function.
* eudc-export.el (eudc-create-bbdb-record): Add support for
bbdb-create-internal argument list changes introduced in BBDB 3.
* eudcb-bbdb.el: Remove bbdb-version defvar.
(eudc-bbdb-field): Call eudc--using-bbdb-3-or-newer-p.
---
 lisp/net/eudc-export.el | 19 +++++++++++++------
 lisp/net/eudc.el        | 12 ++++++++++++
 lisp/net/eudcb-bbdb.el  | 10 +---------
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el
index c60911f..a65f555 100644
--- a/lisp/net/eudc-export.el
+++ b/lisp/net/eudc-export.el
@@ -86,12 +86,19 @@ eudc-create-bbdb-record
 					      (cons (car mapping) value))))
 				       conversion-alist)))
       (setq bbdb-notes (delq nil bbdb-notes))
-      (setq bbdb-record (bbdb-create-internal bbdb-name
-					      bbdb-company
-					      bbdb-net
-					      bbdb-address
-					      bbdb-phones
-					      bbdb-notes))
+      (setq bbdb-record (bbdb-create-internal
+			 bbdb-name
+			 ,@(when (eudc--using-bbdb-3-or-newer-p)
+			     '(nil
+			       nil))
+			 bbdb-company
+			 bbdb-net
+			 ,@(if (eudc--using-bbdb-3-or-newer-p)
+			       '(bbdb-phones
+				 bbdb-address)
+			     '(bbdb-address
+			       bbdb-phones))
+			 bbdb-notes))
       (or silent
 	  (bbdb-display-records (list bbdb-record))))))
 
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 7280d9d..25a26bd 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -107,6 +107,18 @@ eudc-switch-from-server-hook
 ;; attribute name
 (defvar eudc-protocol-has-default-query-attributes nil)
 
+(defvar bbdb-version)
+
+(defun eudc--using-bbdb-3-or-newer-p ()
+  "Return non-nil if BBDB version is 3 or greater."
+  (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)))))
+
 (defun eudc-plist-member (plist prop)
   "Return t if PROP has a value specified in PLIST."
   (if (not (= 0 (% (length plist) 2)))
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 0545304..1972fc1 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -42,21 +42,13 @@
 (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)))))
+	   (eudc--using-bbdb-3-or-newer-p))
       'mail
     field-symbol))
 
-- 
1.8.3.1


  reply	other threads:[~2015-11-22  2:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21 14:30 bug#21971: 25.1.50; EUDC conversion to BBDB 3 incompatibility George McNinch
2015-11-22  2:44 ` Thomas Fitzsimmons [this message]
2015-11-22 15:00   ` George McNinch
2015-11-22 16:36     ` Thomas Fitzsimmons
2015-11-22 17:01       ` George McNinch
2015-11-23  2:46         ` Thomas Fitzsimmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3610u92iy.fsf@fitzsim.org \
    --to=fitzsim@fitzsim.org \
    --cc=21971@debbugs.gnu.org \
    --cc=gmcninch@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).