Mailaprop: A System For Email Address Completion in Emacs ========================================================= I wanted email address completion in mail and message buffers. One way would be to use BBDB, but the problem is that then you have use BBDB. Also, email address completion wasn't working in BBDB last time I tried. Maybe I failed to run some initialization function, or mis-installed BBDB, or whatever. Who knows? It's BBDB. So I wrote my own email address completion. Here's how it works in Emacs 22.0.3: Overview ======== A shell script (run-mailaprop.sh) invokes a Python script (mailaprop.py) on various mbox files. You can use whatever files you want, as long as they're in mbox format and there are desirable email addresses in the headers. The result of run-mailaprop.sh is a file, 'email-addresses.eld' -- that's the completion database. Some custom Elisp code loads it, and then modifies mail-mode and message-mode such that hitting Tab while in a header completes an email address. Detailed Instructions ===================== You'll need to be comfortable modifying your .emacs to do this. First, search for the string "TWEAKME" in the script run-mailaprop.sh (http://svn.red-bean.com/repos/kfogel/trunk/bin/mailaprop/run-mailaprop.sh) and tweak those things appropriately. Next, install http://svn.red-bean.com/repos/kfogel/trunk/bin/mailaprop/mailaprop.py wherever you told run-mailaprop.sh you'd put it. Now invoke run-mailaprop.sh. Congratulations, you've got a file full of email addresses, wherever you told run-mailaprop.sh to put it! You may want to set up a cron job to do this on a regular basis, since your input files will presumably always be accumulating new addresses. Grab my .emacs (http://svn.red-bean.com/repos/kfogel/trunk/.emacs) and snarf these things from it: (defconst kf-email-addresses ...) ;; Adjust in the obvious way. (defun kf-email-complete-address ...) (defun kf-email-handle-tab ...) (defun kf-message-mode-hook ...) ;; You may want to pare this down (defun kf-mail-mode-hook ...) ;; You may want to pare this down (add-hook 'mail-mode-hook 'kf-mail-mode-hook) (add-hook 'message-mode-hook 'kf-message-mode-hook) After evaluating the above, use Tab to complete email addresses when point is in a mail header. *** NOTE THAT EACH EMAIL ADDRESS MUST BE ON ITS OWN LINE *** Finding boundaries between email addresses turns out to be highly non-trivial, so I decided to punt on the problem. Instead, you can only complete an address that is on its own line or on the same line as the header name. Thus, both of these addresses could have been completed: To: J. Random , Victoria O'Hara but not the second one below: To: J. Random , Victoria O'Hara You may also want to copy my 'minibuffer-local-completion-map' and 'minibuffer-local-filename-completion-map' key definitions, so that SPACE is not a completion key when completing email addresses. Since space is often present in the name portion of an address, you'll frequently be typing it in the minibuffer, and it's a mild pain to have to type C-q SPACE to put a space into the string being completed.