I use eudc since I search both ldap and bbdb, but I bet the same sort
of advice could be applied directly to bbdb-complete-name:

(defadvice eudc-expand-inline (around check-aliases-too activate)
  "If eudc-expand-inline doesn't find a match, check for a match in mail-aliases."
  (condition-case nil
      ad-do-it
    (error (dsg-complete-alias))))

(defun dsg-complete-alias ()
  (interactive)
  (let* ((b-o-w (save-excursion
                  (forward-word -1)
                  (point)))
         (word (buffer-substring b-o-w (point)))
         (maybes (all-completions word mail-aliases)))
    (cond ((null maybes)
           (error "no aliases match %s" word))
          ((= (length maybes) 1)
           (delete-region b-o-w (point))
           (insert (car maybes)))
          (t
           (with-output-to-temp-buffer "*Completions*"
             (display-completion-list maybes))))
    (expand-abbrev)))

The dsg-complete-alias function provides completion for mail aliases.
expand-abbrev doesn't seem to do that on its own.  On the other hand,
I wrote this for an older version of xemacs so maybe it's redundant
now.  Someday I'll get around to checking.

hth, 
-- 
Dave Goldberg
[EMAIL PROTECTED]

_______________________________________________
bbdb-info mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/bbdb-info

Reply via email to