diff --git a/lisp/bbdb-com.el b/lisp/bbdb-com.el index a261c85..30a0727 100644 --- a/lisp/bbdb-com.el +++ b/lisp/bbdb-com.el @@ -2142,6 +2142,26 @@ completion with." nil t))) (nth (1- (string-to-number result)) records)))))) +(defun bbdb-completion-at-point (_str) + "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) + (if (or (null bbdb-completion-list) + (eq t bbdb-completion-list)) + (setq strings (hash-table-keys bbdb-hashtable)) + (maphash (lambda (str records) + (dolist (record records) + (when (catch 'bbdb-hash-ok + (bbdb-hash-p str record bbdb-completion-list)) + (push str strings)))) + bbdb-hashtable)) + 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." @@ -2591,7 +2611,7 @@ Rebuilding the aliases is enforced if prefix FORCE-REBUILT is t." (bbdb-pushnew (cons alias expansion) mail-aliases) (define-mail-abbrev alias expansion) - + (unless (setq f-alias (abbrev-symbol alias mail-abbrevs)) (error "Cannot find the alias")) 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