[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11580: [PATCH] Fix bug #11580
From: |
Roland Winkler |
Subject: |
bug#11580: [PATCH] Fix bug #11580 |
Date: |
Sun, 30 Sep 2012 10:12:43 -0500 |
On Sat Sep 29 2012 Sergio Durigan Junior wrote:
> Thank you for the explanations. I think this patch has more to do with
> EUDC than with BBDB, TBH. And this is a simple fix to a long-standing
> problem.
>
> I am afraid I did not understand the last paragraph. Are you saying
> that it is OK to commit this patch upstream?
I am sorry, I really do not know much of EUDC.
> 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.
In any case, I suggest the following simplified / untested patch
(note that the return values of cond are ignored)
--- eudcb-bbdb.el~ 2012-04-07 22:03:02.000000000 -0500
+++ eudcb-bbdb.el 2012-09-30 10:06:03.000000000 -0500
@@ -167,17 +167,18 @@
'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")))))
+ (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)))