>>>>> "MH" == Mikael Hedin <[EMAIL PROTECTED]> writes:
Thomas E Deweese writes:
>
MH> When using bbdb-create-internal, I can insert the same entry
MH> several times, but later when I use bbdb, it bails out with
MH> "Duplicate entries in the database".
>
> By using bbdb-create-internal you are by-passing the normal
> checks that prevent you from creating duplicate records.
MH> Citing the help-function:
MH> Documentation: Adds a record to the database; this function does a
MH> fair amount of error-checking on the passed in values, so it's
MH> safe to call this from other programs. <end cite>
MH> so it should not allow non-valid entries.
Ahh, the problem is with the allowance not the fact that the
two records cause problems, my mistake (I was also a bit wrong
about the bbdb-create-internal...).
MH> Below a patch for the bbdb-divide-name that does not give an empty
MH> string if there is just one name (firs or last). Is it the right
MH> way or am I totally out?
Well I would say that this fixes a 'symtom'. My proposed fix
below should fix the 'problem'.
---
The issue here is a difference of opinion on how to build the
hash-key for a record. bbdb-create-interal uses 'bbdb-build-name' to
check if the record exists. bbdb-hash-record uses
'bbdb-record-name-1' They differ in how they deal with zero length
first and last names.
So we have two options. Create a third function that just does
the first & last name concatination, that both call or simply
syncronize the implementation.
Here is my proposed patch that brings bbdb-build-name in line
with bbdb-record-name-1 (whos behaviour I think is better).
--- bbdb.el.orig Fri May 19 10:49:59 2000
+++ bbdb.el Fri May 19 10:50:43 2000
@@ -1436,9 +1436,12 @@
(defmacro bbdb-build-name (f l)
(list 'downcase
- (list 'if (list 'and f l)
- (list 'concat f " " l)
- (list 'or f l "")))
+ (list 'if (list '= (list 'length f) 0) l
+ (list 'if (list '= (list 'length l) 0) f
+ (list 'concat f " " l)
+ )
+ )
+ )
)
(defun bbdb-remove! (e l)
--
Thomas DeWeese
[EMAIL PROTECTED]
"The only difference between theory and practice is
that in theory there isn't any." -- unknown
_______________________________________________
bbdb-info mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/bbdb-info