All of the hooks variables described below may be set to a symbol or lambda expression, which will be funcalled; or may be set to a list of symbols or lambda expressions, each of which will be funcalled in turn. Almost all hooks in Emacs work this way. But notice that some of the hooks described below are called with arguments.
bbdb-list-hook
bbdb-create-hook
bbdb-change-hook
will be called as
well.
bbdb-change-hook
bbdb-create-hook
will be called.
bbdb-notice-hook
bbdb-change-hook
for that.
You can use this to, for example, add something to the notes field
based on the subject of the current message. It is up to your hook
to determine whether it is running in GNUS, VM,
MH, or RMAIL, and to act appropriately.
Also note that bbdb-change-hook
will not be called as a result of any
modifications you may make to the record inside this hook.
Beware that if the variable bbdb-message-caching-enabled
is
true (a good idea) then when you are using VM, MH, or
RMAIL, this hook will be called only the first time that
message is selected. (The GNUS interface does not use caching.)
When debugging the value of this hook, it is a good idea to set
caching-enabled to nil
.
bbdb-after-read-db-hook
(setq bbdb-after-read-db-hook '(lambda () (rename-buffer " bbdb")))will cause the buffer visiting the
bbdb-file
to be
called " bbdb"
. The leading space in its name will prevent
it from showing up in the buffer list.
bbdb-load-hook
bbdb-canonicalize-net-hook
nil
, it should be a function of one argument: a
network address string. (Note that, unlike the other hook-variables
described above, this may not be a list of functions.) Whenever the
Insidious Big Brother Database "notices" a message, the corresponding
network address will be passed to this function first, as a kind of
"filter" to do whatever transformations upon it you like before it is
compared against or added to the database. For example: it is the case
that CS.CMU.EDU
is a valid return address for all mail
originating at a machine in the .CS.CMU.EDU
domain. So, if you
wanted all such addresses to be canonically hashed as
user@CS.CMU.EDU
, instead of as user@somehost.CS.CMU.EDU
,
you might set this variable to a function like this:
(setq bbdb-canonicalize-net-hook '(lambda (addr) (cond ((string-match "\\`\\([^@]+@\\).*\\.\\(CS\\.CMU\\.EDU\\)\\'" addr) (concat (substring addr (match-beginning 1) (match-end 1)) (substring addr (match-beginning 2) (match-end 2)))) (t addr))))You could also use this function to rewrite UUCP-style addresses into domain-style addresses, or any number of other things. This function will be called repeatedly until it returns a value EQ to the value passed in. So multiple rewrite rules might apply to a single address. There is an example of the use of this variable in the file
bbdb-hooks.el
: the function
sample-bbdb-canonicalize-net-hook
.