E30DC: A glimpse of BBDB, The Insidious Big Brother Database and gnus
3 minutes read | 518 words by Ruben BerenguelKeep your contacts
under control
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
(add-to-list 'load-path
"~/emacs/bbdb/lisp")
(require 'bbdb)
```And activate gnus integration with
(bbdb-initialize ‘gnus ‘message)
(bbdb-insinuate-message)
(add-hook ‘gnus-startup-hook ‘bbdb-insinuate-gnus)
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](https://www.dropbox.com/referrals/NTc3MDIyNTM5?src=global0) with
(setq bbdb-file “~/Dropbox/bbdb”)
This means that my database keeps automagically in sync from my [netbook](http://www.amazon.com/gp/product/B0041K3CGO?ie=UTF8&tag=rbersblog-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B0041K3CGO)![](http://www.assoc-amazon.com/e/ir?t=rbersblog-20&l=as2&o=1&a=B0041K3CGO) and my [MacBook](http://www.amazon.com/gp/product/B001GCTT7G?ie=UTF8&tag=rbersblog-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B001GCTT7G)![](http://www.assoc-amazon.com/e/ir?t=rbersblog-20&l=as2&o=1&a=B001GCTT7G). Now that everything looks fine, let's check [gnus bbdb integration](http://www.mostlymaths.net/2010/12/emacs-30-day-challenge-using-gnus-to.html). 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
(setq bbdb-complete-name-full-completion t)
(setq bbdb-completion-type ‘primary-or-name)
(setq bbdb-complete-name-allow-cycling t)
(setq
bbdb-offer-save 1
bbdb-use-pop-up t
bbdb-electric-p t
bbdb-popup-target-lines 1
)
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).
You may find answer to some bbdb questions in the [emacswiki](http://www.emacswiki.org/emacs/CategoryBbdb).
If you liked this, please share it with your emacs friends through Reddit, Hackernews or whatever you enjoy.
ParseList(ScrambleList(Relateds(emacs)),5)