all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sergio Durigan Junior <sergiodj@riseup.net>
To: "Roland Winkler" <winkler@gnu.org>
Cc: 11580@debbugs.gnu.org, emacs-devel@gnu.org
Subject: Re: bug#11580: [PATCH] Fix bug #11580
Date: Mon, 01 Oct 2012 22:46:59 -0300	[thread overview]
Message-ID: <87d3113ass.fsf@riseup.net> (raw)
In-Reply-To: 20584.24939.541992.925590@gargle.gargle.HOWL

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

	* 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)))
 
 




  parent reply	other threads:[~2012-10-02  1:46 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
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
2012-09-26 17:54 ` Tassilo Horn
2012-09-29 12:04   ` Roland Winkler
2012-09-29 12:04   ` 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-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 [this message]
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

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=87d3113ass.fsf@riseup.net \
    --to=sergiodj@riseup.net \
    --cc=11580@debbugs.gnu.org \
    --cc=emacs-devel@gnu.org \
    --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.