Stefan Monnier <[email protected]> writes:
>>> As Tassilo mentions, maybe we could have a post-completion step that can
>>> perform some kind of expansion/replacement/cleanup once a valid
>>> completion is selected. I'm not sure what that would look like in terms
>>> of code and API, but if someone wants to try it out a propose a patch to
>>> start a discussion, maybe we could add such a thing.
>
>> Or maybe an upper layer mixing abbrev and completion? Trying one at
>> first, the other one after. This could be useful for message-mode for
>> example, since you probably wants to use both.
>
> That might work even better, yes.
>
>
> Stefan
This is what I've been using to insert other people's contact
information into emails. Probably no good for general use, but maybe
will provide food for thought.
#+BEGIN_SRC emacs-lisp
(defun my-cite-contact (name)
(interactive "sName (regexp): ")
(let ((rec)
(records (bbdb-search (bbdb-records) name name name nil nil)))
(if (= (length records) 1)
(setq rec (car records))
(if (zerop (length records))
(error "No matching records")
(setq rec
(let ((int-name (ido-completing-read "Pick one: "
(mapcar 'bbdb-record-name
records))))
(car (bbdb-search (bbdb-records) int-name))))))
(insert (bbdb-dwim-net-address rec))))
#+END_SRC