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