[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#11580: [PATCH] Fix bug #11580
From: |
Sergio Durigan Junior |
Subject: |
Re: bug#11580: [PATCH] Fix bug #11580 |
Date: |
Mon, 01 Oct 2012 22:46:59 -0300 |
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 <address@hidden>
Sergio Durigan Junior <address@hidden>
* 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)))
- Re: bug#11580: [PATCH] Fix bug #11580,
Sergio Durigan Junior <=