Mercurial > hg > xemacs-beta
comparison man/ph.texi @ 173:8eaf7971accc r20-3b13
Import from CVS: tag r20-3b13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:49:09 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
1 \input texinfo.tex | |
2 @c %**start of header | |
3 @setfilename ph.info | |
4 @settitle ph.el Manual | |
5 @iftex | |
6 @afourpaper | |
7 @end iftex | |
8 @c %**end of header | |
9 | |
10 @footnotestyle end | |
11 | |
12 @ifinfo | |
13 This file documents ph.el v2.6 | |
14 | |
15 ph.el is part of GNU Emacs. | |
16 | |
17 ph.el is an E-Lisp client interface to the CCSO white pages directory system | |
18 also known as PH/QI | |
19 | |
20 Copyright @copyright{} 1997 Free Software Foundation, Inc. | |
21 | |
22 Permission is granted to make and distribute verbatim | |
23 copies of this manual provided the copyright notice and | |
24 this permission notice are preserved on all copies. | |
25 | |
26 @ignore | |
27 Permission is granted to process this file through TeX | |
28 and print the results, provided the printed document | |
29 carries a copying permission notice identical to this | |
30 one except for the removal of this paragraph (this | |
31 paragraph not being relevant to the printed manual). | |
32 @end ignore | |
33 | |
34 Permission is granted to copy and distribute modified | |
35 versions of this manual under the conditions for | |
36 verbatim copying and the terms of the ``GNU General | |
37 Public License'', and provided that the entire | |
38 resulting derived work is distributed under the terms | |
39 of a permission notice identical to this one. | |
40 | |
41 Permission is granted to copy and distribute | |
42 translations of this manual into another language, | |
43 under the above conditions for modified versions, | |
44 except that this permission notice may be stated in a | |
45 translation approved by the Free Software Foundation. | |
46 @end ifinfo | |
47 | |
48 @titlepage | |
49 @title{ph Manual} | |
50 @subtitle{An Emacs client to the CCSO Nameserver} | |
51 @author by Oscar Figueiredo | |
52 @code{1.3} | |
53 | |
54 @page | |
55 @vskip 0pt plus 1fill | |
56 Copyright @copyright{} 1997 Free Software Foundation, Inc. | |
57 | |
58 Permission is granted to make and distribute verbatim | |
59 copies of this manual provided the copyright notice and | |
60 this permission notice are preserved on all copies. | |
61 | |
62 @ignore | |
63 Permission is granted to process this file through TeX | |
64 and print the results, provided the printed document | |
65 carries a copying permission notice identical to this | |
66 one except for the removal of this paragraph (this | |
67 paragraph not being relevant to the printed manual). | |
68 | |
69 @end ignore | |
70 | |
71 Permission is granted to copy and distribute modified | |
72 versions of this manual under the conditions for | |
73 verbatim copying and the terms of the ``GNU General | |
74 Public License'', and provided that the entire | |
75 resulting derived work is distributed under the terms | |
76 of a permission notice identical to this one. | |
77 | |
78 Permission is granted to copy and distribute | |
79 translations of this manual into another language, | |
80 under the above conditions for modified versions, | |
81 except that this permission notice may be stated in a | |
82 translation approved by the Free Software Foundation. | |
83 @end titlepage | |
84 | |
85 @ifinfo | |
86 @node Top, Introduction, (dir), (dir) | |
87 @comment node-name, next, previous, up | |
88 | |
89 | |
90 This manual documents ph.el v2.6, an E-lisp client interface to the CCSO | |
91 PH/QI directory system. | |
92 @end ifinfo | |
93 | |
94 @menu | |
95 * Introduction:: General info about the PH/QI directory system | |
96 * Installation:: How to install the package | |
97 * Usage:: The various usage possibilities explained | |
98 * Credits:: Who's done what | |
99 * Variables Index:: | |
100 @end menu | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 @node Introduction, Installation, Top, Top | |
107 @comment node-name, next, previous, up | |
108 @chapter Introduction | |
109 | |
110 The Central Computing Services Office (CCSO) of the University of | |
111 Illinois at Urbana Champaign (UIUC) created and freely distributes a | |
112 directory system that is currently in use in more than 300 organizations | |
113 around the world. The system records information about people such as | |
114 their address, phone number, e-mail, academic information or any other | |
115 details it was configured to. | |
116 | |
117 The system consists of two parts: a database server traditionally called | |
118 @code{qi} and a command-line client called | |
119 @code{ph}. @file{ftp://uiarchive.cso.uiuc.edu/pub/packages/ph} is the | |
120 main distribution site. | |
121 @file{http://www.uiuc.edu/cgi-bin/ph/lookup?Query=.} provides a listing | |
122 of the QI servers in activity. | |
123 | |
124 @code{ph.el} provides a client interface to this directory system | |
125 letting you: | |
126 | |
127 @itemize @bullet | |
128 @item | |
129 query the server through a customizable form | |
130 @item | |
131 expand inline queries in buffers (for instance you can expand a name | |
132 to a mailing address in a mail message buffer) | |
133 @item | |
134 insert server records into your own BBDB database | |
135 (@pxref{Top,,BBDB,bbdb,BBDB Manual}) | |
136 @end itemize | |
137 | |
138 The original command-line @code{ph} client that comes with the | |
139 @code{ph/qi} distribution provides additional features like the | |
140 possibility to communicate with the server in login mode which makes it | |
141 possible to change records in the database. This is not implemented in | |
142 this e-lisp client. | |
143 | |
144 @node Installation, Usage, Introduction, Top | |
145 @comment node-name, next, previous, up | |
146 @chapter Installation | |
147 | |
148 If you are using @code{ph} from your GNU Emacs or XEmacs distribution | |
149 you can skip this section. | |
150 | |
151 @code{ph} should work right out of the box with XEmacs 19.15 and above. | |
152 It will not work with versions of XEmacs below. | |
153 | |
154 @code{ph} will work with Emacs 19.34 provided you have the @code{custom} | |
155 and @code{widget} libraries by Per Abrahmsen installed. You can get them | |
156 from @file{http://www.dina.kvl.dk/~abraham/custom/} | |
157 | |
158 When installing @code{ph} yourself you should move @code{ph.el} to a | |
159 proper directory in your @code{load-path} and byte-compile it (see the | |
160 section on byte-compilation in your users manual if you do not know what | |
161 that means). Install @code{ph.info} into a directory where the info | |
162 system can find it or update your @code{Info-default-directory-list} | |
163 variable. | |
164 | |
165 Then you can add the following into your @file{.emacs} startup file: | |
166 @lisp | |
167 (require 'ph) | |
168 (eval-after-load | |
169 "message" | |
170 '(define-key message-mode-map [(control ?c) (tab)] 'ph-expand-inline)) | |
171 (eval-after-load | |
172 "mail" | |
173 '(define-key mail-mode-map [(control ?c) (tab)] 'ph-expand-inline)) | |
174 @end lisp | |
175 | |
176 Upon starting a new session you will find a new @code{Ph} sub-menu in the | |
177 @code{Tools} menu that will let you access all the interesting @code{ph} | |
178 functions. | |
179 | |
180 | |
181 | |
182 | |
183 | |
184 | |
185 | |
186 @node Usage, Credits, Installation, Top | |
187 @comment node-name, next, previous, up | |
188 @chapter Usage | |
189 | |
190 This chapter describes the usage of @code{ph.el}. Most functions are | |
191 available through the @code{Ph} sub-menu of the @code{Tools} sub-menu. | |
192 | |
193 @menu | |
194 * Querying QI Servers:: How queries are performed and handled | |
195 * Query Form:: How to use and customize the query form | |
196 * Inline Query Expansion:: How to use and customize inline queries | |
197 * Creating BBDB Records:: How to insert query results into your BBDB | |
198 * The Server Hotlist:: How to use and manage the server hotlist | |
199 @end menu | |
200 | |
201 | |
202 @node Querying QI Servers, Query Form, Usage, Usage | |
203 @comment node-name, next, previous, up | |
204 @section Querying Servers | |
205 | |
206 @code{ph} basic functionality is to let you query a QI server and return | |
207 the results back to you. There are several things you may want to | |
208 customize in this process. | |
209 | |
210 | |
211 @menu | |
212 * Selecting a Server:: The first thing to do | |
213 * Return Fields:: How to configure query results | |
214 * Handling Duplicate Fields:: What to do when records have duplicate fields | |
215 @end menu | |
216 | |
217 @node Selecting a Server, Return Fields, Querying QI Servers, Querying QI Servers | |
218 @subsection Selecting a Server | |
219 | |
220 Before doing any query you will need to set the query server, this is | |
221 the name of the host machine running the @code{qi} software. If you do | |
222 not set it in any fashion, @code{ph} will ask you for one when you | |
223 make your first query. | |
224 | |
225 @defvar ph-server | |
226 The name or IP address of the CCSO (PH/QI) server. A port number may be | |
227 specified by appending a colon and a number to the name of the | |
228 server. You will not need this unless your server runs on different port | |
229 than the usual 105. | |
230 @end defvar | |
231 | |
232 @node Return Fields, Handling Duplicate Fields, Selecting a Server, Querying QI Servers | |
233 @subsection Return Fields | |
234 | |
235 @code{qi} servers are configured to return a default set of fields for | |
236 each record matching a query if the query specifies none. The variable | |
237 @code{ph-default-return-fields} controls the return fields you want for | |
238 your queries. | |
239 | |
240 @defvar ph-default-return-fields | |
241 A list of the default fields to extract from CCSO entries. If it | |
242 contains @code{all} then all available fields are returned. @code{nil} | |
243 means return the default fields as configured in the server. Default is | |
244 @code{nil} | |
245 @end defvar | |
246 | |
247 The server may return several matching records to a query. Some of the | |
248 records may however not contain all the fields you requested. You can | |
249 chose to discard those records. | |
250 | |
251 @defopt ph-strict-return-matches | |
252 If non-@code{nil}, entries that do not contain all the requested return | |
253 fields are ignored. Default is @code{t}. | |
254 @end defopt | |
255 | |
256 @node Handling Duplicate Fields, , Return Fields, Querying QI Servers | |
257 @subsection Handling Duplicate Fields | |
258 | |
259 @code{qi} authorizes records to have different instances of the same | |
260 field. For instance the record of a person may contain several e-mail | |
261 fields containing different e-mail addresses. This is difficult to | |
262 distinguish from fields having multi-line values such as the postal | |
263 address that may contain a line for the street and another one for the | |
264 zip code and city name. In both cases, @code{ph} considers the field be | |
265 duplicated. | |
266 | |
267 @code{ph} has several methods to deal with duplicate fields. The | |
268 available methods are: | |
269 | |
270 @table @code | |
271 @item list | |
272 Makes a list with the different values of the duplicate field. The | |
273 record keeps only one instance of the field the value of which is a list | |
274 of all the different values. This is the default method that is used to | |
275 handle duplicate fields for which no other method has been specified. | |
276 @item first | |
277 Discards all the duplicate values of the field keeping only the first | |
278 one. | |
279 @item concat | |
280 Concatenates the different values using @code{\n} as a separator. The | |
281 record keeps only one instance of the field the value of which is a | |
282 single multi-line string. | |
283 @item duplicate | |
284 Duplicates the whole record into as many instances as there are different | |
285 values for the field. This is the default for the e-mail field. Thus a | |
286 record containing 3 different e-mail addresses is duplicated into three | |
287 different records each having a single e-mail address. This is | |
288 particularly useful in combination with @code{select} as the method to | |
289 handle multiple matches in inline expansion queries (@pxref{Inline Query | |
290 Expansion}) because you are presented with the 3 addresses in a | |
291 selection buffer | |
292 @end table | |
293 | |
294 Because a method may not be applicable to all fields, the variable | |
295 @code{ph-duplicate-fields-handling-method} lets you specify either a | |
296 default method for all fields or a method for each individual field. | |
297 | |
298 @defvar ph-duplicate-fields-handling-method | |
299 A method to handle entries containing duplicate fields. This is either | |
300 an alist (@var{field} . @var{method}) or a symbol @var{method}. The | |
301 alist form of the variable associates a method to an individual field, | |
302 the second form specifies a method applicable to all fields. Available | |
303 methods are: @code{list}, @code{first}, @code{concat}, @code{duplicate} | |
304 duplicates the entire entry into as many instances as different values. | |
305 Defaults to @code{list}. | |
306 @end defvar | |
307 | |
308 | |
309 | |
310 @node Query Form, Inline Query Expansion, Querying QI Servers, Usage | |
311 @comment node-name, next, previous, up | |
312 @section Query Form | |
313 | |
314 The simplest way to query your directory server is to use the query | |
315 form. You display the query form with the @code{Query Form} menu item or | |
316 by typing @kbd{M-x ph-query-form}. The fields presented in this form are | |
317 defined by the @code{ph-form-fields} variable (unless a non-@code{nil} | |
318 argument is supplied to @code{ph-query-form}). | |
319 | |
320 @defvar ph-form-fields | |
321 A list of fields presented in the query form. You can get a list of | |
322 valid field names with the @code{List Valid Field Names} menu item or | |
323 @kbd{M-x ph-get-field-list}. Defaults to @code{name}, @code{email} and | |
324 @code{phone}. | |
325 @end defvar | |
326 | |
327 @deffn Command ph-query-form get-fields-from-server | |
328 Display a form to query the CCSO PH/QI Nameserver. | |
329 If given a non-nil argument the function first queries the server | |
330 for the existing fields and displays a corresponding form. | |
331 @end deffn | |
332 | |
333 Since the names of the fields may not be explicit enough or adapted to | |
334 be directly displayed as prompt strings in the form, the variable | |
335 @code{ph-fieldname-formstring-alist} lets you define prompt strings for | |
336 the various fields. | |
337 | |
338 @defvar ph-fieldname-formstring-alist | |
339 This is an alist mapping CCSO database field names onto prompt strings | |
340 used in query/response forms. Prompt strings for fields that are not in | |
341 this alist are derived by replacing underscores with spaces and | |
342 capitalizing the individual words. | |
343 @end defvar | |
344 | |
345 Upon successful completion the command will display a buffer containing | |
346 the results of the query. The fields that are returned for each record | |
347 are controlled by @code{ph-default-return-fields} (@pxref{Return | |
348 Fields}) | |
349 | |
350 @node Inline Query Expansion, Creating BBDB Records, Query Form, Usage | |
351 @comment node-name, next, previous, up | |
352 @section Inline Query Expansion | |
353 | |
354 Instead of using a query form, you may prefer inline expansion. This is | |
355 a powerful method to get completion from your directory server. The most | |
356 common usage is for expanding names to e-mail addresses in mail message | |
357 buffers. The expansion is performed by the command | |
358 @code{ph-expand-inline}. The operation is controlled by the variables | |
359 @code{ph-inline-expansion-format}, @code{ph-inline-query-format-list}, | |
360 @code{ph-expanding-overwrites-query} and | |
361 @code{ph-multiple-match-handling-method} | |
362 | |
363 @deffn Command ph-expand-inline replace-p | |
364 Query the server and expand the query string before point. The query | |
365 string consists of the buffer substring from the point back to the | |
366 preceding comma, colon or beginning of line. If it consists of more than | |
367 one word the variable @code{ph-inline-query-format-list} controls how | |
368 these are mapped onto CCSO database field names. After querying the | |
369 server for the given string, the expansion specified by | |
370 @code{ph-inline-expansion-format} is inserted in the buffer at point. If | |
371 @var{replace-p} is @code{t} then this expansion replaces the query | |
372 string in the buffer. If @code{ph-expanding-overwrites-query} is | |
373 non-@code{nil} then the meaning of @var{replace-p} is negated. | |
374 @end deffn | |
375 | |
376 @defvar ph-inline-query-format-list | |
377 Format of an inline expansion query. If the inline query string | |
378 consists of several words, this list specifies how these individual | |
379 words are associated to CCSO database field names. If @code{nil} all | |
380 the words will be mapped onto the default CCSO database key (generally | |
381 @code{name}). Default is @code{nil}. | |
382 @end defvar | |
383 | |
384 @defvar ph-inline-expansion-format | |
385 This variable lets you control what is exactly inserted into the buffer | |
386 upon an inline expansion request. It is a list whose first element is a | |
387 string passed to @code{format}. Remaining elements are symbols | |
388 corresponding to CCSO database field names, corresponding field values | |
389 are passed as additional arguments to format. Default is @code{("%s" | |
390 email)} but you may want to consider a value like @code{("%s <%s>" name | |
391 email)} | |
392 @end defvar | |
393 | |
394 @defvar ph-multiple-match-handling-method | |
395 This variable controls what to do when multiple entries match a query | |
396 for an inline expansion. Possible values are: | |
397 @table @code | |
398 @item first | |
399 The first match is considered as being the only one, the others are | |
400 discarded. | |
401 @item select | |
402 A selection buffer pops-up where you can choose a particular match. This | |
403 is the default value of the variable. | |
404 @item all | |
405 The expansion uses all records successively | |
406 @item abort | |
407 An error is signaled. The expansion aborts. | |
408 @end table | |
409 | |
410 | |
411 Defaults to @code{select} | |
412 @end defvar | |
413 | |
414 | |
415 | |
416 @node Creating BBDB Records, The Server Hotlist, Inline Query Expansion, Usage | |
417 @comment node-name, next, previous, up | |
418 @section Creating BBDB Records | |
419 | |
420 With @code{ph}, you can automatically create BBDB records | |
421 (@pxref{Top,,BBDB,bbdb,BBDB Manual}) from records you get from a PH/QI | |
422 server. You do this by moving the point to the appropriate record in a | |
423 query result display buffer and invoking the command | |
424 @code{ph-insert-record-at-point-into-bbdb} with the corresponding | |
425 keyboard binding, @kbd{b} @footnote{This keybinding does not actually | |
426 call @code{ph-insert-record-at-point-into-bbdb} but uses | |
427 @code{ph-try-bbdb-insert} instead.} or with the menu. @code{ph} cannot | |
428 update an existing BBDB record and will signal an error if you try to | |
429 insert a record matching an existing one. | |
430 | |
431 Because the CCSO directory system does not enforce a strict record | |
432 format, local installations of the QI server use different names for the | |
433 record fields and have different ways to organize the | |
434 information. Furthermore BBDB has its own record structure that has | |
435 little to do with what is commonly found on QI servers. For these | |
436 reasons the process of converting a record from its QI format to the | |
437 BBDB format is highly customizable. | |
438 | |
439 @defvar ph-bbdb-conversion-alist | |
440 This is the variable that lets you customize how BBDB fields map to | |
441 PH/QI records. Its value is an alist of cells of the form | |
442 @code{(}@var{bbdb-field} . @var{spec-or-list}@code{)}. @var{bbdb-field} is the name of a field that must be defined in your BBDB | |
443 environment (standard field names are @code{name}, @code{company}, @code{net}, @code{phone}, | |
444 @code{address} and @code{notes}). @var{spec-or-list} is either a single | |
445 mapping specification or a list of mapping specifications. Lists of | |
446 mapping specifications are valid for the @code{phone} and | |
447 @code{address} BBDB fields only. @var{spec}s are actually s-expressions | |
448 which are evaluated as follows: | |
449 | |
450 @table @asis | |
451 @item a string | |
452 evaluates to itself | |
453 @item a symbol | |
454 evaluates to the symbol value. Symbols corresponding to PH/QI fields | |
455 present in the record evaluate to the value of the field in the record | |
456 @item a form | |
457 is evaluated as a function. The argument list may contain PH/QI field | |
458 names which evaluate to the corresponding values in the record. The form | |
459 evaluation should return something appropriate for the particular | |
460 @var{bbdb-field} (see @code{bbdb-create-internal}). | |
461 @code{ph-bbdbify-phone} and @code{ph-bbdbify-address} are provided as | |
462 convenience functions to parse phones and addresses. | |
463 @end table | |
464 @end defvar | |
465 | |
466 The default value of @code{ph-bbdb-conversion-alist} is: | |
467 | |
468 @lisp | |
469 ((name . name) | |
470 (net . email) | |
471 (address . (ph-bbdbify-address address "Address")) | |
472 (phone . ((ph-bbdbify-phone phone "Phone") | |
473 (ph-bbdbify-phone office_phone "Office Phone")))) | |
474 @end lisp | |
475 | |
476 This means that: | |
477 | |
478 @itemize @bullet | |
479 @item | |
480 the @code{name} field of the BBDB record gets its value | |
481 from the @code{name} field of the PH/QI record | |
482 @item | |
483 the @code{net} field of the BBDB record gets its value | |
484 from the @code{email} field of the PH/QI record | |
485 @item | |
486 the @code{address} field of the BBDB record is obtained by parsing the | |
487 @code{address} field of the PH/QI record with the function | |
488 @code{ph-bbdbify-address} | |
489 @item | |
490 two @code{phone} fields are created (when possible) in the BBDB record. | |
491 The first one has "Phone" for location and its value is obtained by | |
492 parsing the @code{phone} field of the PH/QI record with the function | |
493 @code{ph-bbdbify-phone}. The second one has "Office Phone" for location | |
494 its value is obtained by parsing the @code{office_phone} field of the | |
495 PH/QI record with the function @code{ph-bbdbify-phone}. | |
496 @end itemize | |
497 | |
498 @defun ph-bbdbify-phone @var{phone} @var{location} | |
499 This is a convenience function provided for use in | |
500 @code{ph-bbdb-conversion-alist}. It parses @var{phone} into a vector | |
501 compatible with @code{bbdb-create-internal}. @var{phone} is either a string | |
502 supposedly containing a phone number or a list of such strings which are | |
503 concatenated. @var{location} is used as the phone location for BBDB. | |
504 @end defun | |
505 | |
506 @defun ph-bbdbify-address @var{addr} @var{location} | |
507 This is a convenience function provided for use in | |
508 @code{ph-bbdb-conversion-alist}. It parses @var{addr} into a vector | |
509 compatible with @code{bbdb-create-internal}. @var{addr} should be an | |
510 address string of no more than four lines or a list of lines. The last | |
511 line is searched for the zip code, city and state name. @var{location} | |
512 is used as the phone location for BBDB. | |
513 @end defun | |
514 | |
515 Note that only a subset of the fields you selected with | |
516 @code{ph-default-return-fields} and that are actually displayed may | |
517 actually be inserted as part of the newly created BBDB record. | |
518 | |
519 | |
520 @node The Server Hotlist, , Creating BBDB Records, Usage | |
521 @comment node-name, next, previous, up | |
522 @section The Server Hotlist | |
523 | |
524 @code{ph} lets you maintain a list of frequently used servers so that you | |
525 can easily switch from one to another. This hotlist appears in the | |
526 @code{Server} sub-menu. You select a server in this list by clicking on | |
527 its name. You can add the current server to the list with the command | |
528 @code{ph-bookmark-current-server}. The list is contained in the variable | |
529 @code{ph-server-hotlist} which is stored in and retrieved from the file | |
530 designated by @code{ph-options-file}. | |
531 | |
532 @deffn Command ph-bookmark-server server | |
533 Add @var{server} to the hotlist of servers | |
534 @end deffn | |
535 | |
536 @deffn Command ph-bookmark-current-server | |
537 Add the current server to the hotlist of servers | |
538 @end deffn | |
539 | |
540 @defvar ph-options-file | |
541 The name of a file where @code{ph} stores its internal variables | |
542 (currently only the hotlist is stored there). @code{ph} will try to load | |
543 that file upon initialization so, if you choose a file name | |
544 different from the defaults @file{~/.ph-options}, be sure to set this | |
545 variable to the appropriate value @emph{before} @code{ph} is itself | |
546 loaded. | |
547 @end defvar | |
548 | |
549 There is currently no way to remove a server from the list other than | |
550 editing directly the @code{ph-options-file}. | |
551 | |
552 | |
553 | |
554 @node Credits, Variables Index, Usage, Top | |
555 @comment node-name, next, previous, up | |
556 @chapter Credits | |
557 | |
558 The original CCSO Nameserver software (@code{ph} & @code{qi}) was | |
559 written at the University of Illinois at Urbana Champaign. | |
560 | |
561 The Emacs client @code{ph.el} was written and is maintained by Oscar | |
562 Figueiredo. | |
563 | |
564 Thanks to Soren Dayton for his suggestions, his enthusiasm and his help | |
565 in testing and proofreading the code and docs. | |
566 | |
567 @node Variables Index, , Credits, Top | |
568 @comment node-name, next, previous, up | |
569 @unnumbered Variables Index | |
570 | |
571 @printindex vr | |
572 | |
573 @contents | |
574 @bye |