The folowing solution was tested with bbdb version 2.35: http://bbdb.sourceforge.net/
I gave the bounty-bonus to @Jules Tamagnan for his interesting approach to displaying the entire record as a potential completion candidate.
The following answer provides for tab-completion using the name field of the database -- completing-read
does not require a match because that optional argument has been omitted.
(defun bbdb-search-with-completion (elidep)
"Display all entries in the BBDB matching the regexp STRING
in either the name(s), company, network address, or notes.
Press the tab key for possible name completions without requiring a match."
(interactive "P")
(let* (
(bbdb-completion-type 'name)
(ht (bbdb-hashtable))
(completion-ignore-case 't)
(string (completing-read "bbdb (regexp): " ht 'bbdb-completion-predicate))
(bbdb-display-layout (bbdb-grovel-elide-arg elidep))
(notes (cons '* string))
(records (bbdb-search (bbdb-records) string string string notes nil)))
(if records
(bbdb-display-records records)
(message "No records matching '%s'" string))))
bbdb-complete-name
to insert an email address, and I use that all the time. Perhaps combining the functionality ofbbdb-complete-name
withbbdb
and/orbbdb-name
would be the easiest way to handle this project. The difference between the former function and the latter two, is that the latter two generate a buffer containing the entire record. I generally use the entire record when I need to call someone or type an envelope.bbdb
library look potentially very interesting, some of which might be able to be used to help with this particular project: bbdb-complete-clicked-name; bbdb-complete-name; bbdb-complete-name-cleanup; bbdb-completing-read-one-record; bbdb-completing-read-record; bbdb-completion-check-record; and, bbdb-completion-predicate