From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Roland Winkler" Newsgroups: gmane.emacs.bugs Subject: bug#11580: [PATCH] Fix bug #11580 Date: Sun, 30 Sep 2012 10:12:43 -0500 Message-ID: <20584.24939.541992.925590__45126.3966192075$1349018035$gmane$org@gargle.gargle.HOWL> References: <87ipb64w5x.fsf@riseup.net> <87mx0c655g.fsf__10545.1882271611$1348682125$gmane$org@thinkpad.tsdh.de> <87d3152fxd.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1349018029 21830 80.91.229.3 (30 Sep 2012 15:13:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Sep 2012 15:13:49 +0000 (UTC) Cc: 11580@debbugs.gnu.org, emacs-devel@gnu.org To: Sergio Durigan Junior Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 30 17:13:54 2012 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 1TILDK-000707-5h for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Sep 2012 17:13:50 +0200 Original-Received: from localhost ([::1]:52128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TILDE-0001tn-On for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Sep 2012 11:13:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TILDC-0001tg-CI for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2012 11:13:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TILDB-00053K-9r for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2012 11:13:42 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TILDB-00053G-6O for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2012 11:13:41 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TILDW-0007R5-3E for bug-gnu-emacs@gnu.org; Sun, 30 Sep 2012 11:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Roland Winkler" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Sep 2012 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11580 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: help Original-Received: via spool by 11580-submit@debbugs.gnu.org id=B11580.134901799128504 (code B ref 11580); Sun, 30 Sep 2012 15:14:02 +0000 Original-Received: (at 11580) by debbugs.gnu.org; 30 Sep 2012 15:13:11 +0000 Original-Received: from localhost ([127.0.0.1]:34792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TILCh-0007Ph-DS for submit@debbugs.gnu.org; Sun, 30 Sep 2012 11:13:11 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:50616) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TILCg-0007PZ-6B for 11580@debbugs.gnu.org; Sun, 30 Sep 2012 11:13:11 -0400 Original-Received: from adsl-68-77-18-65.dsl.emhril.ameritech.net ([68.77.18.65]:60895 helo=regnitz) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TILCI-0002dt-Jl; Sun, 30 Sep 2012 11:12:47 -0400 In-Reply-To: X-Mailer: VM 8.2 trial under 24.1.1 (x86_64-unknown-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:65026 Archived-At: On Sat Sep 29 2012 Sergio Durigan Junior wrote: > Thank you for the explanations. I think this patch has more to do with > EUDC than with BBDB, TBH. And this is a simple fix to a long-standing > problem. > > I am afraid I did not understand the last paragraph. Are you saying > that it is OK to commit this patch upstream? I am sorry, I really do not know much of EUDC. > WDYT of the new patch below? > > + ((and (not (listp val)) (string= val "")) > + nil) ; Do nothing If I understand the patch correctly, its goal is that if a field of a BBDB record is just an empty string, then do not pass the empty string to EUDC. BBDB v3 puts nil into such fields instead of an empty string. I do not know about BBDB v2. In any case, I suggest the following simplified / untested patch (note that the return values of cond are ignored) --- eudcb-bbdb.el~ 2012-04-07 22:03:02.000000000 -0500 +++ eudcb-bbdb.el 2012-09-30 10:06:03.000000000 -0500 @@ -167,17 +167,18 @@ 'record)))) (t (setq val "Unknown BBDB attribute"))) - (if val - (cond - ((memq attr '(phones addresses)) - (setq eudc-rec (append val eudc-rec))) - ((and (listp val) - (= 1 (length val))) - (setq eudc-rec (cons (cons attr (car val)) eudc-rec))) - ((> (length val) 0) - (setq eudc-rec (cons (cons attr val) eudc-rec))) - (t - (error "Unexpected attribute value"))))) + (cond + ((or (not val) + (and (stringp val) (string= val "")))) ; do nothing + ((memq attr '(phones addresses)) + (setq eudc-rec (append val eudc-rec))) + ((and (listp val) + (= 1 (length val))) + (setq eudc-rec (cons (cons attr (car val)) eudc-rec))) + ((> (length val) 0) + (setq eudc-rec (cons (cons attr val) eudc-rec))) + (t + (error "Unexpected attribute value")))) (nreverse eudc-rec)))