Personally, I do not use BBDB as a general address book. Instead, I use it to harvest the e-mail addresses of the people that send me mail, so that the next time I'd like to send e-mail, I can auto-complete the names / e-mail addresses. If you're not using some emacs-based email client, BBDB might not be that useful in practice.
Note that other people are using BBDB for much more, see the Emacswiki-entry for some examples of that. Here, I just give some basics to get you started; please refer to the fine manual for all the details.
So, after you've installed
bbdb (just follow the instructions; alternatively
Ubuntu/Debian users can simply install the
bbdb package), we can add the
.emacs to set it up:
(setq bbdb-file "~/.emacs.d/bbdb") ;; keep ~/ clean; set before loading (require 'bbdb) (bbdb-initialize) (setq bbdb-offer-save 1 ;; 1 means save-without-asking bbdb-use-pop-up t ;; allow popups for addresses bbdb-electric-p t ;; be disposable with SPC bbdb-popup-target-lines 1 ;; very small bbdb-dwim-net-address-allow-redundancy t ;; always use full name bbdb-quiet-about-name-mismatches 2 ;; show name-mismatches 2 secs bbdb-always-add-address t ;; add new addresses to existing... ;; ...contacts automatically bbdb-canonicalize-redundant-nets-p t ;; email@example.com => firstname.lastname@example.org bbdb-completion-type nil ;; complete on anything bbdb-complete-name-allow-cycling t ;; cycle through matches ;; this only works partially bbbd-message-caching-enabled t ;; be fast bbdb-use-alternate-names t ;; use AKA bbdb-elided-display t ;; single-line addresses ;; auto-create addresses from mail bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook bbdb-ignore-some-messages-alist ;; don't ask about fake addresses ;; NOTE: there can be only one entry per header (such as To, From) ;; http://flex.ee.uec.ac.jp/texi/bbdb/bbdb_11.html '(( "From" . "no.?reply\\|DAEMON\\|daemon\\|facebookmail\\|twitter"))) )
This will set up BBDB for you. I have commented the various settings; you can
of course get more information for each of them by putting your cursor on them
(in emacs) and issuing
integration with e-mail clients
Another important part is the integration with e-mail - which is why I am using BBDB in the first place.
(require 'bbdb-wl) (bbdb-wl-setup) ;; i don't want to store addresses from my mailing folders (setq bbdb-wl-folder-regexp ;; get addresses only from these folders "^\.inbox$\\|^.sent") ;; (define-key wl-draft-mode-map (kbd "<C-tab>") 'bbdb-complete-name)
For gnus, you'd use something like:
(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
(I am not using
gnus myself, feel free to add you setup in the comments)
The BBDB-manual has the details for some other mail clients as well.
So, we have everything set up now – but how does it work? Well, whenever you
read e-mails, BBDB stores the various e-mail addresses. Whenever you write an
e-mail, you can complete the names with
M-x bbdb-complete-name, by default
M-TAB. This keybinding conflicts with many window managers, which
Alt-TAB) for window switching. So, it's useful to
rebind it to something else, for example
C-TAB (I already did that for
Wanderlust, in the example above).
I don't use BBDB too much directly, but you can manipulate the address; first
display one with
M-x bbdb-display-address, they you can edit a field by
d' for deleting the field or record,
C-o for adding a new
field and so on – see the whole list.