3.7 Creating BBDB Records

With EUDC, you can automatically create BBDB records (see BBDB in BBDB Manual) from records you get from a directory server. You do this by moving point to the appropriate record in a query result display buffer and invoking the command M-x eudc-insert-record-at-point-into-bbdb with the keyboard binding b1, or with the menu. EUDC cannot update an existing BBDB record and will signal an error if you try to insert a record matching an existing one.

It is also possible to export to BBDB the whole batch of records contained in the directory query result with the command M-x eudc-batch-export-records-to-bbdb.

Because directory systems may not enforce a strict record format, local server installations may use different attribute names and have different ways to organize the information. Furthermore BBDB has its own record structure. For these reasons converting a record from its external directory format to the BBDB format is a highly customizable process.

Variable: eudc-bbdb-conversion-alist

The value of this variable should be a symbol naming an alist defining a mapping between BBDB field names onto directory attribute names records. This is a protocol-local variable and is initialized upon protocol switch (see Server/Protocol Locals). The alist is made of cells of the form (bbdb-field . spec-or-list). bbdb-field is the name of a field that must be defined in your BBDB environment (standard field names are name, company, net, phone, address and notes). spec-or-list is either a single mapping specification or a list of mapping specifications. Lists of mapping specifications are valid for the phone and address BBDB fields only. specs are actually s-expressions which are evaluated as follows:

a string

evaluates to itself

a symbol

evaluates to the symbol value. Symbols corresponding to directory attribute names present in the record evaluate to the value of the field in the record

a form

is evaluated as a function. The argument list may contain attribute names which evaluate to the corresponding values in the record. The form evaluation should return something appropriate for the particular bbdb-field (see bbdb-create-internal). eudc-bbdbify-phone and eudc-bbdbify-address are provided as convenience functions to parse phones and addresses.

Function: eudc-bbdbify-phone phone location

This is a convenience function provided for use in eudc-bbdb-conversion-alist. It parses phone into a vector compatible with bbdb-create-internal. phone is either a string supposedly containing a phone number or a list of such strings which are concatenated. location is used as the phone location for BBDB.

Function: eudc-bbdbify-address addr location

This is a convenience function provided for use in eudc-bbdb-conversion-alist. It parses addr into a vector compatible with bbdb-create-internal. addr should be an address string of no more than four lines or a list of lines. The last line is searched for the zip code, city and state name. location is used as the phone location for BBDB.

Note that only a subset of the attributes you selected with eudc-default-return-attributes and that are actually displayed may actually be inserted as part of the newly created BBDB record.



This key binding does not actually call eudc-insert-record-at-point-into-bbdb but uses eudc-try-bbdb-insert instead.