diff --git a/lisp/bbdb-com.el b/lisp/bbdb-com.el index a261c85..b9b6efa 100644 --- a/lisp/bbdb-com.el +++ b/lisp/bbdb-com.el @@ -2142,6 +2142,20 @@ completion with." nil t))) (nth (1- (string-to-number result)) records)))))) +(defun bbdb-completion-at-point () + "Return a list of strings for completion from the database. +Meant to be used as a completion table in a \"completion at +point\" context." + (let (strings) + (maphash (lambda (str record) + (when (bbdb-hash-p str record #'bbdb-completion-predicate) + (push str strings)))) + strings)) + +(defvar bbdb-completion-at-point-table + (completion-table-dynamic #'bbdb-completion-at-point) + "Completion table for use in completion-at-point functions.") + ;;;###autoload (defun bbdb-completing-read-mails (prompt &optional init) "Like `read-string', but allows `bbdb-complete-mail' style completion." diff --git a/lisp/bbdb-gnus.el b/lisp/bbdb-gnus.el index c2ac987..b36b06f 100644 --- a/lisp/bbdb-gnus.el +++ b/lisp/bbdb-gnus.el @@ -48,6 +48,10 @@ Do not call this in your init file. Use `bbdb-initialize'." ;; (define-key gnus-summary-mode-map "'" 'bbdb-mua-display-recipients) ;; (define-key gnus-summary-mode-map ";" 'bbdb-mua-edit-field-recipients) + (when (boundp 'gnus-search-contact-tables) + (push bbdb-completion-at-point-table + gnus-search-contact-tables)) + ;; Set up user field for use in `gnus-summary-line-format' ;; (1) Big solution: use whole name (if bbdb-mua-summary-unify-format-letter