From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Roland Winkler" Newsgroups: gmane.emacs.devel Subject: Re: bug#11580: [PATCH] Fix bug #11580 Date: Sun, 30 Sep 2012 10:12:43 -0500 Message-ID: <20584.24939.541992.925590@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 1349017975 21452 80.91.229.3 (30 Sep 2012 15:12:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Sep 2012 15:12:55 +0000 (UTC) Cc: 11580@debbugs.gnu.org, emacs-devel@gnu.org To: Sergio Durigan Junior Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 30 17:13:01 2012 Return-path: Envelope-to: ged-emacs-devel@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 1TILCU-0006ag-H8 for ged-emacs-devel@m.gmane.org; Sun, 30 Sep 2012 17:12:58 +0200 Original-Received: from localhost ([::1]:51477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TILCO-0001Ta-U7 for ged-emacs-devel@m.gmane.org; Sun, 30 Sep 2012 11:12:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TILCL-0001TV-PD for emacs-devel@gnu.org; Sun, 30 Sep 2012 11:12:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TILCK-0004ui-RN for emacs-devel@gnu.org; Sun, 30 Sep 2012 11:12:49 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:34613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TILCK-0004ue-NY for emacs-devel@gnu.org; Sun, 30 Sep 2012 11:12:48 -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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153756 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)))