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