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