> Thanks for that code. I am not sure that I have a hacked up version of bbdb, 
> but if then not
the same as you have, for your code did not work.

The function bbdb-define-all-mail-aliases is a redefinition of a standard BBDB 
function
(defined in bbdb-com.el).  It's possible that yours is a lot different from 
mine, so you could
track down the differences between and apply them to your environment.  (Since 
this code is so
old and works in my environment, I probably can't help much in getting it to 
work in your
environment.  Sorry.)

For easy reference, here is the standard bbdb-define-all-mail-aliases from BBDB 
2.34.

(defun bbdb-define-all-aliases ()
  "Define mail aliases for some of the records in the database.
Every record which has a `mail-alias' field will have a mail alias defined for 
it which is the
contents of that field.  If there are
multiple comma-separated words in the `mail-alias' field, then all of those 
words will be
defined as aliases for that person.

If multiple entries in the database have the same mail alias, then that alias 
expands to a
comma-separated list of the network addresses of all of those people."
  (let* ((target (cons bbdb-define-all-aliases-field "."))
         (records (bbdb-search (bbdb-records) nil nil nil target))
         result record aliases match)
    (while records
      (setq record (car records))
      (setq aliases (bbdb-split
                     (bbdb-record-getprop record bbdb-define-all-aliases-field)
                     ","))
      (while aliases
        (if (setq match (assoc (car aliases) result))
            (nconc match (cons record nil))
          (setq result (cons (list (car aliases) record) result)))
        (setq aliases (cdr aliases)))
      (setq records (cdr records)))
    (while result
      (let ((alias (downcase (car (car result))))
            (expansion (mapconcat 'bbdb-dwim-net-address (cdr (car result))
                                  (if (boundp 'mail-alias-separator-string)
                                      mail-alias-separator-string
                                    ", "))))
        (if (fboundp 'define-mail-abbrev)
            (define-mail-abbrev alias expansion)
          (define-mail-alias alias expansion))
        (setq alias (or (intern-soft alias
                         (if (boundp 'mail-abbrevs) mail-abbrevs mail-aliases))
                        (error "couldn't find the alias we just defined!")))
        (or (eq (symbol-function alias) 'mail-abbrev-expand-hook)
            (error "mail-aliases contains unexpected hook %s"
                   (symbol-function alias)))
        ;; The abbrev-hook is called with network addresses instead of bbdb ;; 
records to avoid
keeping pointers to records, which would lose if ;; the database was reverted.  
It uses
-search-simple to convert
        ;; these to records, which is plenty fast.
        (fset alias (list 'lambda '()
                          (list 'bbdb-mail-abbrev-expand-hook
                                (list 'quote
                                      (mapcar
                                       (function
                                        (lambda (x) (car (bbdb-record-net x))))
                                       (cdr (car result))))))))
      (setq result (cdr result)))))





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to