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