From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sergio Durigan Junior Newsgroups: gmane.emacs.bugs Subject: bug#11580: [PATCH] Fix bug #11580 Date: Mon, 01 Oct 2012 22:46:59 -0300 Message-ID: <87d3113ass.fsf__3566.6664866314$1349142490$gmane$org@riseup.net> References: <87ipb64w5x.fsf@riseup.net> <87mx0c655g.fsf__10545.1882271611$1348682125$gmane$org@thinkpad.tsdh.de> <87d3152fxd.fsf@gnu.org> <20584.24939.541992.925590@gargle.gargle.HOWL> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1349142484 28763 80.91.229.3 (2 Oct 2012 01:48:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Oct 2012 01:48:04 +0000 (UTC) Cc: 11580@debbugs.gnu.org, emacs-devel@gnu.org To: "Roland Winkler" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 02 03:48:07 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 1TIraJ-0000J3-5B for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Oct 2012 03:47:43 +0200 Original-Received: from localhost ([::1]:42562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIraD-0002GQ-LY for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Oct 2012 21:47:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIraA-0002GG-5h for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 21:47:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIra9-0001I1-13 for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 21:47:34 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIra8-0001Hw-Tj for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 21:47:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TIrab-0002Sw-Pr for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 21:48:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Sergio Durigan Junior Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Oct 2012 01:48:01 +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.13491424589447 (code B ref 11580); Tue, 02 Oct 2012 01:48:01 +0000 Original-Received: (at 11580) by debbugs.gnu.org; 2 Oct 2012 01:47:38 +0000 Original-Received: from localhost ([127.0.0.1]:36904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TIraE-0002SK-6N for submit@debbugs.gnu.org; Mon, 01 Oct 2012 21:47:38 -0400 Original-Received: from mx1.riseup.net ([204.13.164.18]:48567) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TIraB-0002SC-5N for 11580@debbugs.gnu.org; Mon, 01 Oct 2012 21:47:36 -0400 Original-Received: from fulvetta.riseup.net (fulvetta-pn.riseup.net [10.0.1.75]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Gandi Standard SSL CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id D47D74FDC2; Mon, 1 Oct 2012 18:47:04 -0700 (PDT) Original-Received: from localhost (unknown [187.106.37.6]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: sergiodj@fulvetta.riseup.net) by fulvetta.riseup.net (Postfix) with ESMTPSA id 761AB2B6; Mon, 1 Oct 2012 18:47:03 -0700 (PDT) X-URL: http://sergiodj.net/blog X-Virus-Scanned: clamav-milter 0.97.5 at mx1 X-Virus-Status: Clean 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:65100 Archived-At: On Sunday, September 30 2012, Roland Winkler wrote: >> 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. Thanks for the explanation. BBDB v2 (which I am using now) puts the empty string that I am trying to avoid, thus the patch. > In any case, I suggest the following simplified / untested patch > (note that the return values of cond are ignored) Thanks, the patch is simpler. I took the liberty to make a small correction on your patch, which is to call (error "Unknown BBDB attribute") instead of (setq val "Unknown BBDB attribute"), which I think is a better way to handle it. So, is the patch below OK for mailine? -- Sergio 2012-10-02 Roland Winkler Sergio Durigan Junior * lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): Handle empty strings coming from BBDB. (Bug#11580). === modified file 'lisp/net/eudcb-bbdb.el' --- lisp/net/eudcb-bbdb.el 2012-01-19 07:21:25 +0000 +++ lisp/net/eudcb-bbdb.el 2012-10-02 01:39:38 +0000 @@ -166,18 +166,19 @@ (symbol-name attr))) '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"))))) + (error "Unknown BBDB attribute"))) + (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)))