Received: by 10.68.231.135 with SMTP id tg7mr3743064pbc.2.1349018025153; Sun, 30 Sep 2012 08:13:45 -0700 (PDT) Path: t10ni23595809pbh.0!nntp.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: "Roland Winkler" Newsgroups: gnu.emacs.bug Subject: bug#11580: [PATCH] Fix bug #11580 Date: Sun, 30 Sep 2012 10:12:43 -0500 Lines: 58 Sender: debbugs-submit-boun...@debbugs.gnu.org Approved: bug-gnu-em...@gnu.org Message-ID: References: <87ipb64w5x.fsf@riseup.net> <87mx0c655g.fsf__10545.1882271611$1348682125$gmane$org@thinkpad.tsdh.de> <87d3152fxd.fsf@gnu.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 X-Trace: usenet.stanford.edu 1349018024 1515 208.118.235.17 (30 Sep 2012 15:13:44 GMT) X-Complaints-To: action@cs.stanford.edu Cc: 11...@debbugs.gnu.org, emacs-de...@gnu.org To: Sergio Durigan Junior Envelope-to: bug-gnu-em...@gnu.org X-Loop: help-debb...@gnu.org Resent-From: "Roland Winkler" Original-Sender: debbugs-submit-boun...@debbugs.gnu.org Resent-CC: bug-gnu-em...@gnu.org Resent-Date: Sun, 30 Sep 2012 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debb...@gnu.org X-GNU-PR-Message: followup 11580 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: help In-Reply-To: X-Mailer: VM 8.2 trial under 24.1.1 (x86_64-unknown-linux-gnu) X-BeenThere: debbugs-sub...@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Errors-To: debbugs-submit-boun...@debbugs.gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-em...@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Received-Bytes: 4240 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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)))