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