]> code.delx.au - gnu-emacs/blob - doc/misc/eudc.texi
Merge from emacs-24; up to 2012-12-30T19:34:25Z!jan.h.d@swipnet.se
[gnu-emacs] / doc / misc / eudc.texi
1 \input texinfo.tex
2 @c %**start of header
3 @setfilename ../../info/eudc
4 @settitle Emacs Unified Directory Client (EUDC) Manual
5 @afourpaper
6 @c %**end of header
7
8 @copying
9 This file documents EUDC v1.30b.
10
11 EUDC is the Emacs Unified Directory Client, a common interface to
12 directory servers using various protocols such as LDAP or the CCSO white
13 pages directory system (PH/QI)
14
15 Copyright @copyright{} 1998, 2000--2013 Free Software Foundation, Inc.
16
17 @quotation
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU Free Documentation License, Version 1.3 or
20 any later version published by the Free Software Foundation; with no
21 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
22 and with the Back-Cover Texts as in (a) below. A copy of the license
23 is included in the section entitled ``GNU Free Documentation License''.
24
25 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
26 modify this GNU manual.''
27 @end quotation
28 @end copying
29
30 @dircategory Emacs network features
31 @direntry
32 * EUDC: (eudc). Emacs client for directory servers (LDAP, PH).
33 @end direntry
34
35 @footnotestyle end
36
37 @titlepage
38 @title EUDC Manual
39 @subtitle The Emacs Unified Directory Client
40 @author by Oscar Figueiredo
41 @code{1.30b}
42
43 @page
44 @vskip 0pt plus 1fill
45 @insertcopying
46 @end titlepage
47
48 @contents
49
50 @ifnottex
51 @node Top
52 @top Emacs Unified Directory Client
53
54 @insertcopying
55 @end ifnottex
56
57 @menu
58 * Overview:: Summary of EUDC features
59 * Installation:: How to install EUDC
60 * Usage:: The various usage possibilities explained
61 * Credits:: Who's done what
62 * GNU Free Documentation License:: The license for this documentation.
63 * Command and Function Index::
64 * Variables Index::
65 @end menu
66
67
68
69
70
71 @node Overview
72 @chapter Overview
73
74 EUDC, the @dfn{Emacs Unified Directory Client}, provides a common user
75 interface to access directory servers using different directory
76 protocols.
77
78 Currently supported back-ends are:
79
80 @itemize @bullet
81 @item
82 LDAP, Lightweight Directory Access Protocol
83 @item
84 CCSO PH/QI
85 @item
86 BBDB, Big Brother's Insidious Database
87 @end itemize
88
89 The main features of the EUDC interface are:
90
91 @itemize @bullet
92 @item
93 Queries using a customizable form
94 @item
95 Inline query expansion (for instance you can expand a name
96 to an email address in a mail message buffer using a server as an
97 address book)
98 @item
99 Multiple servers can be tried in turn until a match is found for an
100 inline query
101 @item
102 Fast minibuffer queries for email addresses and phone numbers
103 @item
104 Interface to BBDB to let you insert server records into your own BBDB database
105 (@pxref{Top,,BBDB,bbdb,BBDB Manual})
106 @end itemize
107
108 @menu
109 * LDAP:: What is LDAP ?
110 * CCSO PH/QI:: What is CCSO, PH, QI ?
111 * BBDB:: What is BBDB ?
112 @end menu
113
114
115
116 @node LDAP
117 @section LDAP
118
119 LDAP, @dfn{the Lightweight Directory Access Protocol}, is a communication
120 protocol for directory applications defined in RFC 1777.
121
122 Quoted from RFC 1777:
123
124 @quotation
125 [LDAP] is designed to provide access to the X.500 Directory while not
126 incurring the resource requirements of the Directory Access Protocol
127 (DAP). This protocol is specifically targeted at simple management
128 applications and browser applications that provide simple read/write
129 interactive access to the X.500 Directory, and is intended to be a
130 complement to the DAP itself.
131 @end quotation
132
133 LDAP servers usually store (but are not limited to) information about
134 people such as their name, phone number, email address, office
135 location, etc@enddots{} More information about LDAP can be found at
136 @url{http://www.openldap.org/}.
137
138 EUDC requires external support to access LDAP directory servers
139 (@pxref{LDAP Requirements})
140
141
142 @node CCSO PH/QI
143 @section CCSO PH/QI
144
145 The Central Computing Services Office (CCSO) of the University of
146 Illinois at Urbana Champaign created and freely distributed a
147 directory system that was used by many organizations in the 1990s.
148 The system records information about people such as their address,
149 phone number, email, academic information or any other details it was
150 configured to. Nowadays this system is not widely used.
151
152 The system consists of two parts: a database server traditionally called
153 @samp{qi} and a command-line client called @samp{ph}.
154 @ignore
155 Until 2010, the code could be downloaded from
156 @url{http://www-dev.cites.uiuc.edu/ph/}.
157 @end ignore
158
159 The original command-line @samp{ph} client that came with the
160 @samp{ph/qi} distribution provided additional features that are
161 not implemented in EUDC, like the possibility to communicate with the
162 server in login-mode, which made it possible to change records in the
163 database.
164
165
166 @node BBDB
167 @section BBDB
168
169 BBDB is the @dfn{Big Brother's Insidious Database}, a package for Emacs
170 originally written by Jamie Zawinski which provides rolodex-like
171 database functionality featuring tight integration with the Emacs mail
172 and news readers.
173
174 It is often used as an enhanced email address book.
175
176 EUDC considers BBDB as a directory server back end just like LDAP or
177 PH/QI servers, though BBDB has no client/server protocol and thus always
178 resides locally on your machine. The point in this is not to offer an
179 alternate way to query your BBDB database (BBDB itself provides much
180 more flexible ways to do that), but rather to offer an interface to your
181 local directory that is consistent with the interface to external
182 directories (LDAP, PH/QI). This is particularly interesting when
183 performing queries on multiple servers.
184
185 EUDC also offers a means to insert results from directory queries into
186 your own local BBDB (@pxref{Creating BBDB Records})
187
188 @node Installation
189 @chapter Installation
190
191 Add the following to your @file{.emacs} init file:
192 @lisp
193 (require 'eudc)
194 @end lisp
195 This will install EUDC at startup.
196
197 After installing EUDC you will find (the next time you launch Emacs) a
198 new @code{Directory Search} submenu in the @samp{Tools} menu that will
199 give you access to EUDC.
200
201 You may also find it useful to add the following to your @file{.emacs}
202 initialization file to add a shortcut for email address expansion in
203 email composition buffers (@pxref{Inline Query Expansion})
204
205 @lisp
206 (eval-after-load
207 "message"
208 '(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
209 (eval-after-load
210 "sendmail"
211 '(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
212 @end lisp
213
214 @menu
215 * LDAP Requirements:: EUDC needs external support for LDAP
216 @end menu
217
218 @node LDAP Requirements
219 @section LDAP Requirements
220
221 LDAP support is added by means of @file{ldap.el}, which is part of Emacs.
222 @file{ldap.el} needs an external command line utility named
223 @file{ldapsearch}, available as part of Open LDAP
224 (@url{http://www.openldap.org/}).
225
226
227 @node Usage
228 @chapter Usage
229
230 This chapter describes the usage of EUDC@. Most functions and
231 customization options are available through the @samp{Directory Search}
232 submenu of the @samp{Tools} submenu.
233
234 @menu
235 * Querying Servers:: How queries are performed and handled
236 * Query Form:: How to use and customize the query form
237 * Display of Query Results:: Controlling how query results are presented
238 * Inline Query Expansion:: How to use and customize inline queries
239 * The Server Hotlist:: How to use and manage the server hotlist
240 * Multi-server Queries:: How to query multiple servers successively
241 * Creating BBDB Records:: How to insert query results into your BBDB
242 * Server/Protocol Locals:: Customizing on a per server/protocol basis
243 @end menu
244
245
246 @node Querying Servers
247 @section Querying Servers
248
249 EUDC's basic functionality is to let you query a directory server and
250 return the results back to you. There are several things you may want
251 to customize in this process.
252
253
254 @menu
255 * Selecting a Server:: The first thing to do
256 * Return Attributes:: Configuring what the server should return
257 * Duplicate Attributes:: What to do when records have duplicate attributes
258 @end menu
259
260 @node Selecting a Server
261 @subsection Selecting a Server
262
263 Before doing any query you will need to set the directory server. You
264 need to specify the name of the host machine running the server software
265 and the protocol to use. If you do not set the server in any fashion,
266 EUDC will ask you for one when you make your first query.
267
268 You can set the server by selecting one from your hotlist of servers
269 (@pxref{The Server Hotlist}) available in the @samp{Server} submenu or
270 by selecting @samp{New Server} in that same menu.
271
272 LDAP servers generally require some configuration before you can perform
273 queries on them. In particular, the @dfn{search base} must be
274 configured. If the server you select has no configured search base then
275 EUDC will propose you to configure it at this point. A customization
276 buffer will be displayed where you can edit the search base and other
277 parameters for the server.
278
279 @defvar eudc-server
280 The name or IP address of the remote directory server. A TCP port number
281 may be specified by appending a colon and a number to the name of the
282 server. You will not need this unless your server runs on a port other
283 than the default (which depends on the protocol).
284 If the directory server resides on your own computer (which is the case
285 if you use the BBDB back end) then `localhost' is a reasonable value but
286 it will be ignored anyway.
287 @end defvar
288
289 @defvar eudc-protocol
290 The directory protocol to use to query the server. Currently supported
291 protocols in this version of EUDC are @code{ph}, @code{ldap} and @code{bbdb}.
292 @end defvar
293
294 @deffn Command eudc-set-server
295 This command accessible from @samp{New Server} submenu lets you specify a
296 new directory server and protocol.
297 @end deffn
298
299 @node Return Attributes
300 @subsection Return Attributes
301
302 Directory servers may be configured to return a default set of
303 attributes for each record matching a query if the query specifies none.
304 The variable @code{eudc-default-return-attributes} controls the return
305 attributes you want to see, if different from the server defaults.
306
307 @defvar eudc-default-return-attributes
308 A list of the default attributes to extract from directory entries. If
309 set to the symbol @code{all} then all available attributes are
310 returned. A value of @code{nil}, the default, means to return the
311 default attributes as configured in the server.
312 @end defvar
313
314 The server may return several matching records to a query. Some of the
315 records may however not contain all the attributes you requested. You can
316 discard those records.
317
318 @defopt eudc-strict-return-matches
319 If non-@code{nil}, entries that do not contain all the requested return
320 attributes are ignored. Default is @code{t}.
321 @end defopt
322
323 @node Duplicate Attributes
324 @subsection Duplicate Attributes
325
326 Directory standards may authorize different instances of the same
327 attribute in a record. For instance the record of a person may contain
328 several email fields containing different email addresses. When using
329 a QI directory server this is difficult to distinguish from attributes
330 having multi-line values such as the postal address that may contain a
331 line for the street and another one for the zip code and city name. In
332 both cases, EUDC will consider the attribute duplicated.
333
334 EUDC has several methods to deal with duplicated attributes. The
335 available methods are:
336
337 @table @code
338 @item list
339 Makes a list with the different values of the duplicate attribute. The
340 record is returned with only one instance of the attribute with a list
341 of all the different values as a value. This is the default method that
342 is used to handle duplicate fields for which no other method has been
343 specified.
344 @item first
345 Discards all the duplicate values of the field keeping only the first
346 one.
347 @item concat
348 Concatenates the different values using a newline as a separator. The
349 record keeps only one instance of the field the value of which is a
350 single multi-line string.
351 @item duplicate
352 Duplicates the whole record into as many instances as there are different
353 values for the field. This is the default for the email field. Thus a
354 record containing 3 different email addresses is duplicated into three
355 different records each having a single email address. This is
356 particularly useful in combination with @code{select} as the method to
357 handle multiple matches in inline expansion queries (@pxref{Inline Query
358 Expansion}) because you are presented with the 3 addresses in a
359 selection buffer
360 @end table
361
362 Because a method may not be applicable to all fields, the variable
363 @code{eudc-duplicate-attribute-handling-method} lets you specify either a
364 default method for all fields or a method for each individual field.
365
366 @defvar eudc-duplicate-attribute-handling-method
367 A method to handle entries containing duplicate attributes. This is
368 either an alist of elements @code{(@var{attr} . @var{method})}, or a symbol
369 @var{method}. The alist form of the variable associates a method to an
370 individual attribute name; the second form specifies a method applicable
371 to all attribute names. Available methods are: @code{list},
372 @code{first}, @code{concat}, and @code{duplicate} (see above). The default is
373 @code{list}.
374 @end defvar
375
376
377
378 @node Query Form
379 @section Query Form
380
381 The simplest way to query your directory server is to use the query
382 form. You display the query form with the @samp{Query with Form} menu
383 item or by invoking the command @kbd{M-x eudc-query-form}. The attribute
384 names presented in this form are defined by the
385 @code{eudc-query-form-attributes} variable (unless a non-@code{nil}
386 argument is supplied to @code{eudc-query-form}).
387
388 Since the different directory protocols to which EUDC interfaces may
389 use different names for equivalent attributes, EUDC defines its own set
390 of attribute names and a mapping between these names and their
391 protocol-specific equivalent through the variable
392 @code{eudc-protocol-attributes-translation-alist}. Names currently
393 defined by EUDC are @code{name}, @code{firstname}, @code{email} and
394 @code{phone}.
395
396 @defvar eudc-query-form-attributes
397 @findex eudc-get-attribute-list
398 A list of attributes presented in the query form. Attribute names in
399 this list should be either EUDC attribute names or valid attribute
400 names. You can get a list of valid attribute names for the current
401 protocol with the @samp{List Valid Attribute Names} menu item or the
402 @kbd{M-x eudc-get-attribute-list} command. Defaults to @code{name},
403 @code{email} and @code{phone}.
404 @end defvar
405
406 @deffn Command eudc-query-form get-fields-from-server
407 Display a form to query the directory server. If given a non-@code{nil}
408 argument the function first queries the server for the existing fields
409 and displays a corresponding form. Not all protocols may support a
410 non-@code{nil} argument here.
411 @end deffn
412
413 Since the names of the fields may not be explicit enough or adapted to
414 be directly displayed as prompt strings in the form, the variable
415 @code{eudc-user-attribute-names-alist} lets you define more explicit
416 names for directory attribute names. This variable is ignored if
417 @code{eudc-use-raw-directory-names} is non-@code{nil}.
418
419 @defvar eudc-user-attribute-names-alist
420 This is an alist of user-defined names for the directory attributes used in
421 query/response forms. Prompt strings for attributes that are not in this
422 alist are derived by splitting the attribute name at underscores and
423 capitalizing the individual words.
424 @end defvar
425
426 @defvar eudc-use-raw-directory-names
427 If non-@code{nil}, use attributes names as defined in the directory.
428 Otherwise, directory query/response forms display the user attribute
429 names defined in @code{eudc-user-attribute-names-alist}.
430 @end defvar
431
432 @node Display of Query Results
433 @section Display of Query Results
434
435 Upon successful completion of a form query, EUDC will display a buffer
436 containing the results of the query.
437
438 The fields that are returned for each record
439 are controlled by @code{eudc-default-return-attributes} (@pxref{Return
440 Attributes}).
441
442 The display of each individual field can be performed by an arbitrary
443 function which allows specific processing for binary values, such as
444 images or audio samples, as well as values with semantics, such as
445 URLs.
446
447 @defvar eudc-attribute-display-method-alist
448 An alist specifying methods to display attribute values. Each member of
449 the list is of the form @code{(@var{name} . @var{func})} where
450 @var{name} is a lowercased string naming a directory attribute
451 (translated according to @code{eudc-user-attribute-names-alist} if
452 @code{eudc-use-raw-directory-names} is non-@code{nil}) and @var{func} a
453 function that will be passed the corresponding attribute values for
454 display.
455 @end defvar
456
457 This variable has protocol-local definitions (see @pxref{Server/Protocol
458 Locals}). For instance, it is defined as follows for LDAP:
459
460 @lisp
461 (eudc-protocol-set 'eudc-attribute-display-method-alist
462 '(("jpegphoto" . eudc-display-jpeg-inline)
463 ("labeledurl" . eudc-display-url)
464 ("audio" . eudc-display-sound)
465 ("labeledurl" . eudc-display-url)
466 ("url" . eudc-display-url))
467 'ldap)
468 @end lisp
469
470 EUDC provides a set of built-in functions to display binary value types:
471
472 @defun eudc-display-generic-binary data
473 Display a button for unidentified binary @var{data}.
474 @end defun
475
476 @defun eudc-display-url url
477 Display URL and make it clickable.
478 @end defun
479
480 @defun eudc-display-sound data
481 Display a button to play the sound @var{data}.
482 @end defun
483
484 @defun eudc-display-jpeg-inline data
485 Display the JPEG @var{data} inline at point if possible.
486 @end defun
487
488 @defun eudc-display-jpeg-as-button data
489 Display a button for the JPEG @var{data}.
490 @end defun
491
492 Right-clicking on a binary value button pops up a contextual menu with
493 options to process the value. Among these are saving the attribute
494 value to a file or sending it to an external viewer command. External
495 viewers should expect the value on their standard input and should
496 display it or perform arbitrary processing on it. Messages sent to
497 standard output are discarded. External viewers are listed in the
498 variable @code{eudc-external-viewers} which you can customize.
499
500 @defvar eudc-external-viewers
501 This is a list of viewer program specifications. Each specification is
502 a list whose first element is a string naming the viewer for unique
503 identification, the second element is the executable program which
504 should be invoked and the following elements are arguments that should
505 be passed to the program.
506 @end defvar
507
508
509 @node Inline Query Expansion
510 @section Inline Query Expansion
511
512 Inline query expansion is a powerful method to get completion from your
513 directory server. The most common usage is for expanding names to email
514 addresses in mail message buffers. The expansion is performed by the
515 command @kbd{M-x eudc-expand-inline} which is available from the
516 @samp{Expand Inline Query} menu item but can also be conveniently
517 bound to a key shortcut (@pxref{Installation}). The operation is
518 controlled by the variables @code{eudc-inline-expansion-format},
519 @code{eudc-inline-query-format},
520 @code{eudc-expanding-overwrites-query} and
521 @code{eudc-multiple-match-handling-method}.
522
523 If the query fails for a server, other servers may be tried successively
524 until one of them finds a match (@pxref{Multi-server Queries}).
525
526 @deffn Command eudc-expand-inline replace-p
527 Query the server and expand the query string before point. The query
528 string consists of the buffer substring from the point back to the
529 preceding comma, colon or beginning of
530 line. @code{eudc-inline-query-format} controls how individual words
531 are mapped onto directory attribute names. After querying the server
532 for the given string, the expansion specified by
533 @code{eudc-inline-expansion-format} is inserted in the buffer at
534 point. If @var{replace-p} is @code{t} then this expansion replaces the
535 query string in the buffer. If @code{eudc-expanding-overwrites-query}
536 is non-@code{nil} then the meaning of @var{replace-p} is negated.
537 @end deffn
538
539 @defvar eudc-inline-query-format
540 Format of an inline expansion query.
541 This is actually a list of @var{format}s. A @var{format} is a list of
542 one or more EUDC attribute names. A @var{format} applies if it contains
543 as many attributes as individual words in the inline query string. If
544 several @var{format}s apply then they are tried in order until a match
545 is found. If @code{nil} all the words will be mapped onto the default
546 server/protocol attribute name (generally @code{name}).
547
548 For instance, use the following
549 @lisp
550 (setq eudc-inline-query-format '((name)
551 (firstname)
552 (firstname name)))
553 @end lisp
554 @noindent
555 to indicate that single word expansion queries are to be considered as
556 surnames and if no match is found then they should be tried as first
557 names. Inline queries consisting of two words are considered as
558 consisting of a first name followed by a surname. If the query consists
559 of more than two words, then the first one is considered as the first
560 name and the remaining words are all considered as surname constituents.
561
562 @var{format}s are in fact not limited to EUDC attribute names, you can
563 use server or protocol specific names in them. It may be safer if you
564 do so, to set the variable @code{eudc-inline-query-format} in a protocol
565 or server local fashion (see @pxref{Server/Protocol Locals}).
566
567 For instance you could use the following to match up to three words
568 against the @code{cn} attribute of LDAP servers:
569 @lisp
570 (eudc-protocol-set 'eudc-inline-query-format
571 '((cn)
572 (cn cn)
573 (cn cn cn))
574 'ldap)
575 @end lisp
576 @end defvar
577
578 @defvar eudc-inline-expansion-format
579 This variable lets you control exactly what is inserted into the buffer
580 upon an inline expansion request. It is a list whose first element is a
581 string passed to @code{format}. Remaining elements are symbols
582 corresponding to directory attribute names. The corresponding attribute
583 values are passed as additional arguments to @code{format}. Default is
584 @code{("%s" email)} but you may want to consider a value like @code{("%s
585 <%s>" name email)}
586 @end defvar
587
588 @defvar eudc-multiple-match-handling-method
589 This variable controls what to do when multiple entries match a query
590 for an inline expansion. Possible values are:
591 @table @code
592 @item first
593 The first match is considered as being the only one, the others are
594 discarded.
595 @item select
596 A selection buffer pops up where you can choose a particular match. This
597 is the default value of the variable.
598 @item all
599 The expansion uses all records successively
600 @item abort
601 An error is signaled. The expansion aborts.
602 @end table
603
604 Default is @code{select}
605 @end defvar
606
607
608
609 @node The Server Hotlist
610 @section The Server Hotlist
611
612 EUDC lets you maintain a list of frequently used servers so that you
613 can easily switch from one to another. This hotlist appears in the
614 @samp{Server} submenu. You select a server in this list by clicking on
615 its name. You can add the current server to the list with the command
616 @kbd{M-x eudc-bookmark-current-server}. The list is contained in the variable
617 @code{eudc-server-hotlist} which is stored in and retrieved from the file
618 designated by @code{eudc-options-file}. EUDC also provides a facility to
619 edit the hotlist interactively (@pxref{The Hotlist Edit Buffer}).
620
621 The hotlist is also used to make queries on multiple servers
622 successively (@pxref{Multi-server Queries}). The order in which the
623 servers are tried is the order they appear in the hotlist, therefore it
624 is important to sort the hotlist appropriately.
625
626 @deffn Command eudc-bookmark-server server
627 Add @var{server} to the hotlist of servers
628 @end deffn
629
630 @deffn Command eudc-bookmark-current-server
631 Add the current server to the hotlist of servers
632 @end deffn
633
634 @defvar eudc-options-file
635 The name of a file where EUDC stores its internal variables
636 (the hotlist and the current server). EUDC will try to load
637 that file upon initialization so, if you choose a file name
638 different from the defaults @file{~/.eudc-options}, be sure to set this
639 variable to the appropriate value @emph{before} EUDC is itself
640 loaded.
641 @end defvar
642
643 @menu
644 * The Hotlist Edit Buffer:: An interactive hotlist editing facility
645 @end menu
646
647 @node The Hotlist Edit Buffer
648 @subsection The Hotlist Edit Buffer
649
650 The hotlist edit buffer offers a means to manage a list of frequently
651 used servers. Commands are available in the context pop-up menu
652 generally bound to the right mouse button. Those commands also have
653 equivalent key bindings.
654
655 @deffn Command eudc-hotlist-add-server
656 Bound to @kbd{a}.
657 Add a new server to the hotlist on the line after point
658 @end deffn
659
660 @deffn Command eudc-hotlist-delete-server
661 Bound to @kbd{d}.
662 Delete the server on the line point is on
663 @end deffn
664
665 @deffn Command eudc-hotlist-select-server
666 Bound to @kbd{s}.
667 Select the server the point is on as the current directory server for
668 the next queries
669 @end deffn
670
671 @deffn Command eudc-hotlist-transpose-servers
672 Bound to @kbd{t}.
673 Bubble up the server the point is on to the top of the list
674 @end deffn
675
676 @deffn Command eudc-hotlist-quit-edit
677 Bound to @kbd{q}.
678 Save the changes and quit the hotlist edit buffer. Use @kbd{x} or
679 @kbd{M-x kill-buffer} to exit without saving.
680 @end deffn
681
682
683 @node Multi-server Queries
684 @section Multi-server Queries
685
686 When using inline query expansion (@pxref{Inline Query Expansion}), EUDC
687 can try to query successively a sequence of directory servers until one
688 of them successfully finds a match for the query.
689
690 @defvar eudc-inline-expansion-servers
691 This variable controls which servers are tried and in which order when
692 trying to perform an inline query. Possible values are:
693 @table @code
694 @item current-server
695 Only the current directory server is tried
696 @item hotlist
697 The servers in the hotlist are tried in order until one finds a match
698 for the query or `eudc-max-servers-to-query' is reached
699 @item server-then-hotlist
700 The current server then the servers in the hotlist are tried in the
701 order they appear in the hotlist until one of them finds a match or
702 `eudc-max-servers-to-query' is reached. This is the default.
703 @end table
704 @end defvar
705
706 @defvar eudc-max-servers-to-query
707 This variable indicates the maximum number of servers to query when
708 performing a multi-server query. The default, @code{nil}, indicates
709 that all available servers should be tried.
710 @end defvar
711
712
713
714 @node Creating BBDB Records
715 @section Creating BBDB Records
716
717 @findex eudc-insert-record-at-point-into-bbdb
718 @findex eudc-try-bbdb-insert
719 With EUDC, you can automatically create BBDB records
720 (@pxref{Top,,BBDB,bbdb,BBDB Manual}) from records you get from a
721 directory server. You do this by moving point to the appropriate
722 record in a query result display buffer and invoking the command
723 @kbd{M-x eudc-insert-record-at-point-into-bbdb} with the
724 keyboard binding @kbd{b}@footnote{This key binding does not actually
725 call @code{eudc-insert-record-at-point-into-bbdb} but uses
726 @code{eudc-try-bbdb-insert} instead.}, or with the menu. EUDC
727 cannot update an existing BBDB record and will signal an error if you
728 try to insert a record matching an existing one.
729
730 @findex eudc-batch-export-records-to-bbdb
731 It is also possible to export to BBDB the whole batch of records
732 contained in the directory query result with the command
733 @kbd{M-x eudc-batch-export-records-to-bbdb}.
734
735 Because directory systems may not enforce a strict record format, local
736 server installations may use different attribute names and have
737 different ways to organize the information. Furthermore BBDB has its own
738 record structure. For these reasons converting a record from its
739 external directory format to the BBDB format is a highly customizable
740 process.
741
742 @defvar eudc-bbdb-conversion-alist
743 The value of this variable should be a symbol naming an alist defining a
744 mapping between BBDB field names onto directory attribute names records.
745 This is a protocol-local variable and is initialized upon protocol
746 switch (@pxref{Server/Protocol Locals}). The alist is made of cells of the
747 form @code{(@var{bbdb-field} . @var{spec-or-list})}.
748 @var{bbdb-field} is the name of a field
749 that must be defined in your BBDB environment (standard field names are
750 @code{name}, @code{company}, @code{net}, @code{phone}, @code{address}
751 and @code{notes}).
752 @var{spec-or-list} is either a single mapping specification or a list of
753 mapping specifications. Lists of mapping specifications are valid for
754 the @code{phone} and @code{address} BBDB fields only. @var{spec}s are
755 actually s-expressions which are evaluated as follows:
756
757 @table @asis
758 @item a string
759 evaluates to itself
760 @item a symbol
761 evaluates to the symbol value. Symbols corresponding to directory
762 attribute names present in the record evaluate to the value of the field
763 in the record
764 @item a form
765 is evaluated as a function. The argument list may contain attribute
766 names which evaluate to the corresponding values in the record. The form
767 evaluation should return something appropriate for the particular
768 @var{bbdb-field} (see @code{bbdb-create-internal}).
769 @code{eudc-bbdbify-phone} and @code{eudc-bbdbify-address} are provided as
770 convenience functions to parse phones and addresses.
771 @end table
772 @end defvar
773
774 The default value of the PH-specific value of that variable is
775 @code{eudc-ph-bbdb-conversion-alist}:
776
777 @lisp
778 ((name . name)
779 (net . email)
780 (address . (eudc-bbdbify-address address "Address"))
781 (phone . ((eudc-bbdbify-phone phone "Phone")
782 (eudc-bbdbify-phone office_phone "Office Phone"))))
783 @end lisp
784
785 This means that:
786
787 @itemize @bullet
788 @item
789 the @code{name} field of the BBDB record gets its value
790 from the @code{name} attribute of the directory record
791 @item
792 the @code{net} field of the BBDB record gets its value
793 from the @code{email} attribute of the directory record
794 @item
795 the @code{address} field of the BBDB record is obtained by parsing the
796 @code{address} attribute of the directory record with the function
797 @code{eudc-bbdbify-address}
798 @item
799 two @code{phone} fields are created (when possible) in the BBDB record.
800 The first one has @cite{Phone} for location and its value is obtained by
801 parsing the @code{phone} attribute of the PH/QI record with the function
802 @code{eudc-bbdbify-phone}. The second one has @cite{Office Phone} for location
803 its value is obtained by parsing the @code{office_phone} attribute of the
804 PH/QI record with the function @code{eudc-bbdbify-phone}.
805 @end itemize
806
807 @defun eudc-bbdbify-phone phone location
808 This is a convenience function provided for use in
809 @code{eudc-bbdb-conversion-alist}. It parses @var{phone} into a vector
810 compatible with @code{bbdb-create-internal}. @var{phone} is either a string
811 supposedly containing a phone number or a list of such strings which are
812 concatenated. @var{location} is used as the phone location for BBDB.
813 @end defun
814
815 @defun eudc-bbdbify-address addr location
816 This is a convenience function provided for use in
817 @code{eudc-bbdb-conversion-alist}. It parses @var{addr} into a vector
818 compatible with @code{bbdb-create-internal}. @var{addr} should be an
819 address string of no more than four lines or a list of lines. The last
820 line is searched for the zip code, city and state name. @var{location}
821 is used as the phone location for BBDB.
822 @end defun
823
824 Note that only a subset of the attributes you selected with
825 @code{eudc-default-return-attributes} and that are actually displayed may
826 actually be inserted as part of the newly created BBDB record.
827
828
829 @node Server/Protocol Locals
830 @section Server/Protocol Locals
831
832 EUDC can be customized independently for each server or directory
833 protocol. All variables can be given local bindings that are activated
834 when a particular server and/or protocol becomes active. This is much
835 like buffer-local bindings but on a per server or per protocol basis.
836
837 @menu
838 * Manipulating local bindings:: Functions to set and query local bindings
839 @end menu
840
841 @node Manipulating local bindings
842 @subsection Manipulating local bindings
843
844 EUDC offers functions that let you set and query variables on a per
845 server or per protocol basis.
846
847 The following predicates allow you to test the existence of
848 server/protocol local bindings for a particular variable.
849
850 @defun eudc-server-local-variable-p var
851 Return non-@code{nil} if @var{var} has server-local bindings
852 @end defun
853
854 @defun eudc-protocol-local-variable-p var
855 Return non-@code{nil} if @var{var} has protocol-local bindings
856 @end defun
857
858 The following functions allow you to set the value of a variable with
859 various degrees of locality.
860
861 @defun eudc-default-set var val
862 Set the EUDC default value of @var{var} to @var{val}.
863 The current binding of @var{var} (if local to the current server or
864 protocol) is not changed.
865 @end defun
866
867 @defun eudc-protocol-set var val &optional protocol
868 Set the binding of @var{var} local to @var{protocol} to @var{val}. If
869 omitted, @var{protocol} defaults to the current value of
870 @code{eudc-protocol}. The current binding of @var{var} is changed only
871 if @var{protocol} is omitted.
872 @end defun
873
874 @defun eudc-server-set var val &optional server
875 Set the binding of @var{var} local to @var{server} to @var{val}. If
876 omitted, @var{server} defaults to the current value of
877 @code{eudc-server}. The current binding of @var{var} is changed only if
878 @var{server} is omitted.
879 @end defun
880
881 @defun eudc-set var val
882 Set the most local (server, protocol or default) binding of @var{var} to
883 @var{val}. The current binding of @var{var} is also set to @var{val}.
884 @end defun
885
886 The following variables allow you to query the various bindings of a
887 variable (local or non-local).
888
889 @defun eudc-variable-default-value var
890 Return the default binding of @var{var} (outside of a particular server
891 or protocol local binding).
892 Return @code{unbound} if @var{var} has no EUDC default value.
893 @end defun
894
895 @defun eudc-variable-protocol-value var &optional protocol
896 Return the value of @var{var} local to @var{protocol}. Return
897 @code{unbound} if @var{var} has no value local to @var{protocol}.
898 @var{protocol} defaults to @code{eudc-protocol}.
899 @end defun
900
901 @defun eudc-variable-server-value var [server]
902 Return the value of @var{var} local to @var{server}.
903 Return @code{unbound} if @var{var} has no value local to @var{server}.
904 @var{server} defaults to @code{eudc-server}.
905 @end defun
906
907 Changing a protocol-local or server-local value of a variable has no
908 effect on its current value. The following command is used to
909 synchronize the current values of variables with their local values
910 given the current @code{eudc-server} and @code{eudc-protocol}:
911
912 @defun eudc-update-local-variables
913 Update all EUDC variables according to their local settings.
914 @end defun
915
916
917
918 @node Credits
919 @chapter Credits
920
921 EUDC was written by Oscar Figueiredo based on @file{ph.el} by the
922 same author.
923
924 Thanks to Soren Dayton for his suggestions, his enthusiasm and his help
925 in testing and proofreading the code and docs of @file{ph.el}.
926
927 @node GNU Free Documentation License
928 @appendix GNU Free Documentation License
929 @include doclicense.texi
930
931 @node Command and Function Index
932 @unnumbered Command and Function Index
933
934 @printindex fn
935
936 @node Variables Index
937 @unnumbered Variables Index
938
939 @printindex vr
940
941 @bye