From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Fix bug #11580 Date: Wed, 26 Sep 2012 19:54:51 +0200 Message-ID: <87mx0c655g.fsf@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 1348682109 29850 80.91.229.3 (26 Sep 2012 17:55:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Sep 2012 17:55:09 +0000 (UTC) Cc: 11580@debbugs.gnu.org, winkler@gnu.org, emacs-devel@gnu.org To: Sergio Durigan Junior Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 26 19:55:12 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 1TGvpE-0002Af-CG for ged-emacs-devel@m.gmane.org; Wed, 26 Sep 2012 19:55:08 +0200 Original-Received: from localhost ([::1]:47161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGvp9-0005B5-D5 for ged-emacs-devel@m.gmane.org; Wed, 26 Sep 2012 13:55:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGvp1-000560-T4 for emacs-devel@gnu.org; Wed, 26 Sep 2012 13:55:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGvp0-00056d-Kh for emacs-devel@gnu.org; Wed, 26 Sep 2012 13:54:55 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:59883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGvp0-00056R-GV; 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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.111.4.25 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:153594 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