I must be getting really stupid, because I can't find the definition
of `bbdb-record-cache' in the source...  What the heck is going on?
Anyway, try the replacement function...

In my case, it works for 'aka and 'net, but I'm not sure what it returns
in the case of 'name...  It looks as if it returns all the people
working in the same company.  Pretty annoying.  So anyway, give it a
try.  All it does it use "" instead of nil for the fields.

(bbdb-show-duplicates '(aka))
(bbdb-show-duplicates '(net))
(bbdb-show-duplicates '(name))

Alex.

(defun bbdb-find-duplicates (&optional fields)
  "*Find all records that have duplicate entries for given FIELDS.
FIELDS should be a list of the symbols `name', `net', and/or `aka'.
Note that overlap between these fields is noted if either is selected
(most common case `aka' and `name').  If FIELDS is not given it
defaults to all of them.

The results of the search is returned as a list of records."
  (setq fields (or fields '(name net aka)))
  (let ((records (bbdb-records))
    rec hash ret)
    (while records
      (setq rec (car records))

      (and (memq 'name fields)
       (setq hash (bbdb-gethash (downcase (or (bbdb-record-name rec) ""))))
       (> (length hash) 1)
       (setq ret (append hash ret)))

      (if (memq 'net fields)
      (let ((nets (bbdb-record-net rec)))
        (while nets
          (setq hash (bbdb-gethash (downcase (or (car nets) ""))))
          (if (> (length hash) 1)
          (setq ret (append hash ret)))
          (setq nets (cdr nets)))))

      (if (memq 'aka fields)
      (let ((aka (bbdb-record-aka rec)))
        (while aka
          (setq hash (bbdb-gethash (downcase (or (car aka) ""))))
          (if (> (length hash) 1)
          (setq ret (append hash ret)))
          (setq aka (cdr aka)))))
      (setq records (cdr records)))
    (bbdb-remove-memq-duplicates ret)))

Alex.

_______________________________________________
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to