Re: bbdb-record-set-field, strings, and 'eq

2015-03-11 Thread Roland Winkler
On Wed Mar 11 2015 Eric Abrahamsen wrote:
 For this issue, this patch ought to do it.

The optional arg COMPARE-FN of add-to-list defaults to equal.

Roland

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-record-set-field, strings, and 'eq

2015-03-11 Thread Eric Abrahamsen
Eric Abrahamsen e...@ericabrahamsen.net writes:

 Roland Winkler wink...@gnu.org writes:

 On Tue Mar 10 2015 Eric Abrahamsen wrote:
 When `bbdb-record-set-field' is setting a phone or address field, it
 adds the new label to the list of existing labels like this:
 
 (add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq)
 
 The labels are strings, and 'eq comparison means they're never
 equal

 Thank you, that's a bug, though fortunately one that does not affect
 daily usage of BBDB too much.  I guess I thought these labels were
 symbols when I wrote this code.  The same problem exists with
 bbdb-address-label-list.

 Yeah, I figured they were probably symbols at some point. And no, it
 certainly never became an issue -- I wouldn't have even noticed if I
 hadn't tried to upgrade helm-bbdb.

 I have several (more or less minor) patches for BBDB waiting, where
 lately I was too busy with other things to install them.  I hope
 that soon I'll find the time to do that.

 Let us know if you want any help. I ought to have push access to the
 savannah repo, if it's just a matter of formatting some patches and
 throwing them up there.

For this issue, this patch ought to do it.

E

From 0c5e9862df8cd3e8fd8a6844f34f7b3e614f06ac Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen e...@ericabrahamsen.net
Date: Wed, 11 Mar 2015 18:03:29 +0800
Subject: [PATCH] Compare phone/address labels using equal

* lisp/bbdb.el (bbdb-record-set-field, bbdb-parse-records): When
  collecting labels for phone and address fields, add-to-list should
  compare with equal.
---
 lisp/bbdb.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/bbdb.el b/lisp/bbdb.el
index f32a74b..88725fc 100644
--- a/lisp/bbdb.el
+++ b/lisp/bbdb.el
@@ -2831,7 +2831,7 @@ See also `bbdb-record-field'.
value 'equal)))
(if check (bbdb-check-type value (bbdb-record-phone record-type) t))
(dolist (phone value)
- (add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq))
+ (add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'equal))
(bbdb-record-set-phone record value))
 
   ;; Address
@@ -2840,7 +2840,7 @@ See also `bbdb-record-field'.
value 'equal)))
(if check (bbdb-check-type value (bbdb-record-address record-type) t))
(dolist (address value)
- (add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil 'eq)
+ (add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil 'equal)
  (mapc (lambda (street) (bbdb-add-to-list 'bbdb-street-list street))
(bbdb-address-streets address))
  (bbdb-add-to-list 'bbdb-city-list (bbdb-address-city address))
@@ -3263,9 +3263,9 @@ If `bbdb-file' uses an outdated format, it is migrated to `bbdb-file-format'.
 
   ;; Set the completion lists
   (dolist (phone (bbdb-record-phone record))
-(add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq))
+(add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'equal))
   (dolist (address (bbdb-record-address record))
-(add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil 'eq)
+(add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil 'equal)
 (mapc (lambda (street) (bbdb-add-to-list 'bbdb-street-list street))
   (bbdb-address-streets address))
 (bbdb-add-to-list 'bbdb-city-list (bbdb-address-city address))
-- 
2.3.2

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: bbdb-record-set-field, strings, and 'eq

2015-03-11 Thread Eric Abrahamsen
Roland Winkler wink...@gnu.org writes:

 On Wed Mar 11 2015 Eric Abrahamsen wrote:
 For this issue, this patch ought to do it.

 The optional arg COMPARE-FN of add-to-list defaults to equal.

So it does! Here's another.

From 49be4b2f1e22075eb41c29a6e9e3e37fe23dc255 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen e...@ericabrahamsen.net
Date: Wed, 11 Mar 2015 18:03:29 +0800
Subject: [PATCH] Compare phone/address labels as strings

* lisp/bbdb.el (bbdb-record-set-field, bbdb-parse-records): When
  collecting labels for phone and address fields, add-to-list should
  use the default equal test for comparison.
---
 lisp/bbdb.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/bbdb.el b/lisp/bbdb.el
index f32a74b..62dfc92 100644
--- a/lisp/bbdb.el
+++ b/lisp/bbdb.el
@@ -2831,7 +2831,7 @@ See also `bbdb-record-field'.
value 'equal)))
(if check (bbdb-check-type value (bbdb-record-phone record-type) t))
(dolist (phone value)
- (add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq))
+ (add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil))
(bbdb-record-set-phone record value))
 
   ;; Address
@@ -2840,7 +2840,7 @@ See also `bbdb-record-field'.
value 'equal)))
(if check (bbdb-check-type value (bbdb-record-address record-type) t))
(dolist (address value)
- (add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil 'eq)
+ (add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil)
  (mapc (lambda (street) (bbdb-add-to-list 'bbdb-street-list street))
(bbdb-address-streets address))
  (bbdb-add-to-list 'bbdb-city-list (bbdb-address-city address))
@@ -3263,9 +3263,9 @@ If `bbdb-file' uses an outdated format, it is migrated to `bbdb-file-format'.
 
   ;; Set the completion lists
   (dolist (phone (bbdb-record-phone record))
-(add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq))
+(add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil))
   (dolist (address (bbdb-record-address record))
-(add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil 'eq)
+(add-to-list 'bbdb-address-label-list (bbdb-address-label address) nil)
 (mapc (lambda (street) (bbdb-add-to-list 'bbdb-street-list street))
   (bbdb-address-streets address))
 (bbdb-add-to-list 'bbdb-city-list (bbdb-address-city address))
-- 
2.3.2

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: bbdb-record-set-field, strings, and 'eq

2015-03-10 Thread Eric Abrahamsen
Roland Winkler wink...@gnu.org writes:

 On Tue Mar 10 2015 Eric Abrahamsen wrote:
 When `bbdb-record-set-field' is setting a phone or address field, it
 adds the new label to the list of existing labels like this:
 
 (add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq)
 
 The labels are strings, and 'eq comparison means they're never
 equal

 Thank you, that's a bug, though fortunately one that does not affect
 daily usage of BBDB too much.  I guess I thought these labels were
 symbols when I wrote this code.  The same problem exists with
 bbdb-address-label-list.

Yeah, I figured they were probably symbols at some point. And no, it
certainly never became an issue -- I wouldn't have even noticed if I
hadn't tried to upgrade helm-bbdb.

 I have several (more or less minor) patches for BBDB waiting, where
 lately I was too busy with other things to install them.  I hope
 that soon I'll find the time to do that.

Let us know if you want any help. I ought to have push access to the
savannah repo, if it's just a matter of formatting some patches and
throwing them up there.

Eric


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-record-set-field, strings, and 'eq

2015-03-10 Thread Roland Winkler
On Tue Mar 10 2015 Eric Abrahamsen wrote:
 When `bbdb-record-set-field' is setting a phone or address field, it
 adds the new label to the list of existing labels like this:
 
 (add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq)
 
 The labels are strings, and 'eq comparison means they're never
 equal

Thank you, that's a bug, though fortunately one that does not affect
daily usage of BBDB too much.  I guess I thought these labels were
symbols when I wrote this code.  The same problem exists with
bbdb-address-label-list.

I have several (more or less minor) patches for BBDB waiting, where
lately I was too busy with other things to install them.  I hope
that soon I'll find the time to do that.

Roland

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


bbdb-record-set-field, strings, and 'eq

2015-03-10 Thread Eric Abrahamsen
When `bbdb-record-set-field' is setting a phone or address field, it
adds the new label to the list of existing labels like this:

(add-to-list 'bbdb-phone-label-list (bbdb-phone-label phone) nil 'eq)

The labels are strings, and 'eq comparison means they're never equal, so
duplicate strings are added each time:

(length bbdb-phone-label-list) - 197

(length (delete-dups bbdb-phone-label-list)) - 7

I'm assuming it should just be using 'equal instead -- is there any
reason for the duplication?

Eric


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/