From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#11580: [PATCH] Fix bug #11580 Date: Wed, 26 Sep 2012 19:54:51 +0200 Message-ID: <87mx0c655g.fsf__10545.1882271611$1348682125$gmane$org@thinkpad.tsdh.de> References: <87ipb64w5x.fsf@riseup.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1348682120 29952 80.91.229.3 (26 Sep 2012 17:55:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Sep 2012 17:55:20 +0000 (UTC) Cc: 11580@debbugs.gnu.org, winkler@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 Wed Sep 26 19:55:23 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 1TGvpT-0002II-6c for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Sep 2012 19:55:23 +0200 Original-Received: from localhost ([::1]:48425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGvpO-0005vb-6C for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Sep 2012 13:55:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGvpE-0005Rt-JQ for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2012 13:55:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGvp9-0005Bc-Cd for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2012 13:55:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGvp9-0005Ax-A1 for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2012 13:55:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TGvp8-0006HJ-1r for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2012 13:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Sep 2012 17:55: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.134868209724119 (code B ref 11580); Wed, 26 Sep 2012 17:55:02 +0000 Original-Received: (at 11580) by debbugs.gnu.org; 26 Sep 2012 17:54:57 +0000 Original-Received: from localhost ([127.0.0.1]:57344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGvp2-0006Gx-Kb for submit@debbugs.gnu.org; Wed, 26 Sep 2012 13:54:56 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48398) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TGvoz-0006Gn-Lw for 11580@debbugs.gnu.org; Wed, 26 Sep 2012 13:54:54 -0400 Original-Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id ABFAD20981; Wed, 26 Sep 2012 13:54:53 -0400 (EDT) Original-Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 26 Sep 2012 13:54:53 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:references:date :in-reply-to:message-id:mime-version:content-type; s=smtpout; bh=y4sqn6GLHh5XJmsUdLvM9ORgJe0=; b=jNP1wYNwSpoDFC9vdiFOBwnv+blr fBqvVT5xsZEA8tb69AUfjwqwzA44MMfUMXglbRSDyq2reqzqDU3G87aWivyZVcaO T0P3FWwVE3r4qQdhGQy+3xBN/DEFpAC7l4IB9wOfBfVMWo16koGw9PqZBg07Nu3m M/zZI/C4omx4ko4= X-Sasl-enc: IwReSoUEbRkQ2UyWcIDORL8Gu7t+5pCs8+8WKmK/8aXG 1348682093 Original-Received: from thinkpad.tsdh.de (unknown [91.67.8.160]) by mail.messagingengine.com (Postfix) with ESMTPA id DFE264827DD; Wed, 26 Sep 2012 13:54:52 -0400 (EDT) Mail-Followup-To: Sergio Durigan Junior , emacs-devel@gnu.org, 11580@debbugs.gnu.org, winkler@gnu.org In-Reply-To: <87ipb64w5x.fsf@riseup.net> (Sergio Durigan Junior's message of "Fri, 21 Sep 2012 23:40:42 -0300") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) 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:64927 Archived-At: Sergio Durigan Junior writes: Hi Sergio, > The attached patch fixes the bug listed on $SUBJECT. Maybe there are > better ways to fix it, but a quick hack did the trick so I am sending > it for review. I don't use bbdb, so I've Cc-ed Roland who is the current bbdb maintainer. Roland, the complete bug thread is here: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11580 In general, I think the patch isn't wrong, but somehow the whole function looks awkward to me. COMMENTs inside: --8<---------------cut here---------------start------------->8--- (defun eudc-bbdb-format-record-as-result (record) "Format the BBDB RECORD as a EUDC query result record. The record is filtered according to `eudc-bbdb-current-return-attributes'" (let ((attrs (or eudc-bbdb-current-return-attributes '(firstname lastname aka company phones addresses net notes))) attr eudc-rec val) (while (prog1 (setq attr (car attrs)) (setq attrs (cdr attrs))) (cond ((eq attr 'phones) (setq val (eudc-bbdb-extract-phones record))) ((eq attr 'addresses) (setq val (eudc-bbdb-extract-addresses record))) ((memq attr '(firstname lastname aka company net notes)) (setq val (eval (list (intern (concat "bbdb-record-" (symbol-name attr))) 'record)))) (t ;; COMMENT1: Shouldn't that be (error "Unknown BBDB attribute")? ;; Now, we'll enter the case of COMMENT3 with that val. (setq val "Unknown BBDB attribute"))) ;; COMMENT2: Your change, basically ok. Before it was just (if val ... (if (and val (or (listp val) (not (string= 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))) ;; COMMENT3: Don't we need to distinguish between a list of ;; length > 0 and a string of length > 0? Or can't that happen? ((> (length val) 0) (setq eudc-rec (cons (cons attr val) eudc-rec))) (t (error "Unexpected attribute value"))))) (nreverse eudc-rec))) --8<---------------cut here---------------end--------------->8--- Bye, Tassilo