20101221

Bbdb stands for The Insidious Big Brother Database, and is a very powerful contact book for emacs. It holds names, emails, aliases and other information and has good integration with gnus, wanderlust and vm (view mail). In my case, I have only checked gnus integration which is indeed pretty good.

This is the third installment in the set of posts for the emacs 30 Day Challenge: doing everything (as far as possible) from within emacs.

First you'll need o get the package from SourceForge here. Uncompress in something like ~/emacs/bbdb. The following lines can be add either to your usual .emacs file (if you want to use it 'always') or to your .gnus.el if you will use bbdb only when you use gnus. You can activate it with

You are ready to start filling your database! The first step I took here was moving my bbdb file (the main contact database) to Dropbox with

(setq bbdb-file "~/Dropbox/bbdb")

This means that my database keeps automagically in sync from my netbook and my MacBook. Now that everything looks fine, let's check gnus bbdb integration. M-x gnus, open some email from your inbox and press : (colon). Voilà! You should have a newly created buffer with an automatic bbdb entry for the mail sender. You can edit the newly created record with e or add a new field with C-o. Also, delete the current field with d, and the current record if you are in the first field. For more information, press C-h m.

Once you have something in your database, you can search through it with M-x bbdb (or via anything.el integration, but this package is a topic for another post), and send an email to a contact by getting the cursor over their record and pressing m. This uses the default emacs mail sender, and you probably prefer to send this mail via gnus (I do, to take advantage of multiple SMTP accounts). To use it add the following to your .gnus.el:

(setq bbdb-send-mail-style 'gnus)

But most times, I start writing an email and then decide to whom I want to send it. And bbdb together with gnus has a good method of doing this. You only need to type the first few characters of the name (forename or surname) or the first few characters of the (primary) net address and press tab to fill to the first result, and keep pressing tab to cycle to all possible completions. To get this, add the following

where 1 means save without asking (one yes-and-no question you can skip, usually), and the other options make the default bbdb 'record found' screen very small and disposable by pressing space (i.e. electric).