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