all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Sergio Durigan Junior <sergiodj@riseup.net>
Cc: 11580@debbugs.gnu.org, winkler@gnu.org, emacs-devel@gnu.org
Subject: bug#11580: [PATCH] Fix bug #11580
Date: Wed, 26 Sep 2012 19:54:51 +0200	[thread overview]
Message-ID: <87mx0c655g.fsf__10545.1882271611$1348682125$gmane$org@thinkpad.tsdh.de> (raw)
In-Reply-To: <87ipb64w5x.fsf@riseup.net> (Sergio Durigan Junior's message of "Fri, 21 Sep 2012 23:40:42 -0300")

Sergio Durigan Junior <sergiodj@riseup.net> 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





  reply	other threads:[~2012-09-26 17:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-22  2:40 [PATCH] Fix bug #11580 Sergio Durigan Junior
2012-09-26 17:54 ` Tassilo Horn [this message]
2012-09-29 12:04   ` bug#11580: " Roland Winkler
2012-09-29 19:30     ` Sergio Durigan Junior
2012-09-29 19:30     ` Sergio Durigan Junior
2012-09-30 15:12       ` Roland Winkler
2012-05-29  5:14         ` bug#11580: 23.3; EUDC can't handle empty last names in BBDB Sergio Durigan Junior
     [not found]           ` <handler.11580.B.133834110724596.ack@debbugs.gnu.org>
2012-07-12  2:00             ` bug#11580: Acknowledgement (23.3; EUDC can't handle empty last names in BBDB) Sergio Durigan Junior
2012-07-12 14:37               ` Stefan Monnier
2012-10-02  1:46           ` bug#11580: [PATCH] Fix bug #11580 Sergio Durigan Junior
2012-10-02  1:46         ` Sergio Durigan Junior
2012-10-02  1:58           ` Roland Winkler
2012-10-02  2:50             ` Sergio Durigan Junior
2012-10-02  3:59           ` Stefan Monnier
2012-10-02  3:59           ` Stefan Monnier
2012-10-02  5:10           ` Chong Yidong
2012-10-02  5:10           ` Chong Yidong
2012-09-30 15:12       ` Roland Winkler
2012-09-29 12:04   ` Roland Winkler
2012-09-26 17:54 ` Tassilo Horn
2012-09-26 18:18   ` Sergio Durigan Junior
2012-09-26 18:56     ` bug#11580: " Tassilo Horn
2012-09-26 18:18   ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='87mx0c655g.fsf__10545.1882271611$1348682125$gmane$org@thinkpad.tsdh.de' \
    --to=tsdh@gnu.org \
    --cc=11580@debbugs.gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=sergiodj@riseup.net \
    --cc=winkler@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.