Mercurial > emacs
annotate lisp/net/eudc-vars.el @ 109229:d3e42c34c64a
Merge from mainline.
author | Katsumi Yamaoka <katsumi@flagship2> |
---|---|
date | Wed, 23 Jun 2010 13:17:54 +0000 |
parents | 1d1d5d9bd884 |
children | 280c8ae2476d 376148b31b5e |
rev | line source |
---|---|
27313 | 1 ;;; eudc-vars.el --- Emacs Unified Directory Client |
2 | |
74509 | 3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
106815 | 4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
27313 | 5 |
42778
6d743d659035
New maintainer. Change author's address.
Pavel Janík <Pavel@Janik.cz>
parents:
42574
diff
changeset
|
6 ;; Author: Oscar Figueiredo <oscar@cpe.fr> |
6d743d659035
New maintainer. Change author's address.
Pavel Janík <Pavel@Janik.cz>
parents:
42574
diff
changeset
|
7 ;; Maintainer: Pavel Janík <Pavel@Janik.cz> |
42574 | 8 ;; Keywords: comm |
27313 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
27313 | 13 ;; it under the terms of the GNU General Public License as published by |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
27313 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
27313 | 24 |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35355
diff
changeset
|
25 ;;; Commentary: |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35355
diff
changeset
|
26 |
27313 | 27 ;;; Code: |
28 | |
29 (require 'custom) | |
30 | |
31 ;;{{{ EUDC Main Custom Group | |
32 | |
32229 | 33 (defgroup eudc nil |
27313 | 34 "Emacs Unified Directory Client." |
32229 | 35 :version "21.1" |
36 :link '(info-link "(eudc)") | |
27313 | 37 :group 'mail |
38 :group 'comm) | |
39 | |
40 (defcustom eudc-server nil | |
41 "*The name or IP address of the directory server. | |
42 A port number may be specified by appending a colon and a | |
43 number to the name of the server. Use `localhost' if the directory | |
44 server resides on your computer (BBDB backend)." | |
35355
581e16bc15c7
(eudc-server, eudc-protocol): Fix :type.
Dave Love <fx@gnu.org>
parents:
32229
diff
changeset
|
45 :type '(choice (string :tag "Server") (const :tag "None" nil)) |
27313 | 46 :group 'eudc) |
47 | |
48 ;; Known protocols (used in completion) | |
49 ;; Not to be mistaken with `eudc-supported-protocols' | |
50 (defvar eudc-known-protocols '(bbdb ph ldap)) | |
51 | |
52 (defvar eudc-supported-protocols nil | |
53 "Protocols currently supported by EUDC. | |
54 This variable is updated when protocol-specific libraries | |
55 are loaded, *do not change manually*.") | |
56 | |
57 (defcustom eudc-protocol nil | |
58 "*The directory protocol to use to query the server. | |
59 Supported protocols are specified by `eudc-supported-protocols'." | |
60 :type `(choice :menu-tag "Protocol" | |
32229 | 61 ,@(mapcar (lambda (s) |
27313 | 62 (list 'const ':tag (symbol-name s) s)) |
35355
581e16bc15c7
(eudc-server, eudc-protocol): Fix :type.
Dave Love <fx@gnu.org>
parents:
32229
diff
changeset
|
63 eudc-known-protocols) |
581e16bc15c7
(eudc-server, eudc-protocol): Fix :type.
Dave Love <fx@gnu.org>
parents:
32229
diff
changeset
|
64 (const :tag "None" nil)) |
27313 | 65 :group 'eudc) |
66 | |
67 | |
68 (defcustom eudc-strict-return-matches t | |
69 "*Ignore or allow entries not containing all requested return attributes. | |
70 If non-nil, such entries are ignored." | |
71 :type 'boolean | |
72 :group 'eudc) | |
73 | |
74 (defcustom eudc-default-return-attributes nil | |
75 "*A list of default attributes to extract from directory entries. | |
76 If set to the symbol `all', return all attributes. | |
77 A value of nil means return the default attributes as configured in the | |
78 server." | |
79 :type '(choice :menu-tag "Return Attributes" | |
80 (const :menu-tag "Server defaults (nil)" nil) | |
81 (const :menu-tag "All" all) | |
32229 | 82 (repeat :menu-tag "Attribute list" |
27313 | 83 :tag "Attribute name" |
84 :value (nil) | |
85 (symbol :tag "Attribute name"))) | |
86 :group 'eudc) | |
87 | |
88 (defcustom eudc-multiple-match-handling-method 'select | |
89 "*What to do when multiple entries match an inline expansion query. | |
32229 | 90 Possible values are: |
27313 | 91 `first' (equivalent to nil) which means keep the first match only, |
92 `select' pop-up a selection buffer, | |
93 `all' expand to all matches, | |
94 `abort' the operation is aborted, an error is signaled." | |
95 :type '(choice :menu-tag "Method" | |
32229 | 96 (const :menu-tag "Use First" |
27313 | 97 :tag "Use First" first) |
32229 | 98 (const :menu-tag "Select Interactively" |
27313 | 99 :tag "Select Interactively" select) |
32229 | 100 (const :menu-tag "Use All" |
27313 | 101 :tag "Use All" all) |
32229 | 102 (const :menu-tag "Abort Operation" |
27313 | 103 :tag "Abort Operation" abort) |
32229 | 104 (const :menu-tag "Default (Use First)" |
27313 | 105 :tag "Default (Use First)" nil)) |
106 :group 'eudc) | |
107 | |
108 (defcustom eudc-duplicate-attribute-handling-method '((email . duplicate)) | |
109 "*A method to handle entries containing duplicate attributes. | |
110 This is either an alist (ATTR . METHOD) or a symbol METHOD. | |
111 The alist form of the variable associates a method to an individual attribute, | |
112 the second form specifies a method applicable to all attributes. | |
113 Available methods are: | |
114 `list' or nil lets the value of the attribute be a list of values, | |
115 `first' keeps the first value and discards the others, | |
116 `concat' concatenates the values into a single multiline string, | |
32229 | 117 `duplicate' duplicates the entire entry into as many instances as |
27313 | 118 different values." |
119 :type '(choice (const :menu-tag "List" list) | |
120 (const :menu-tag "First" first) | |
121 (const :menu-tag "Concat" concat) | |
122 (const :menu-tag "Duplicate" duplicate) | |
123 (repeat :menu-tag "Per Attribute Specification" | |
124 :tag "Per Attribute Specification" | |
125 (cons :tag "Attribute/Method" | |
126 :value (nil . list) | |
127 (symbol :tag "Attribute name") | |
128 (choice :tag "Method" | |
129 :menu-tag "Method" | |
130 (const :menu-tag "List" list) | |
131 (const :menu-tag "First" first) | |
132 (const :menu-tag "Concat" concat) | |
133 (const :menu-tag "Duplicate" duplicate))))) | |
134 :group 'eudc) | |
135 | |
32229 | 136 (defcustom eudc-inline-query-format '((name) |
27313 | 137 (firstname name)) |
138 "*Format of an inline expansion query. | |
32229 | 139 This is a list of FORMATs. A FORMAT is itself a list of one or more |
27313 | 140 EUDC attribute names. A FORMAT applies if it contains as many attributes as |
141 there are individual words in the inline query string. | |
32229 | 142 If several FORMATs apply then they are tried in order until a match |
143 is found. | |
144 If nil, all the words are mapped onto the default server or protocol | |
27313 | 145 attribute name. |
146 | |
147 The attribute names in FORMATs are not restricted to EUDC attribute names | |
148 but can also be protocol/server specific names. In this case, this variable | |
149 must be set in a protocol/server-local fashion, see `eudc-server-set' and | |
150 `eudc-protocol-set'." | |
151 :tag "Format of Inline Expansion Queries" | |
152 :type '(repeat | |
153 (repeat | |
154 :menu-tag "Format" | |
155 :tag "Format" | |
156 (choice | |
157 :tag "Attribute" | |
158 (const :menu-tag "First Name" :tag "First Name" firstname) | |
159 (const :menu-tag "Surname" :tag "Surname" name) | |
160 (const :menu-tag "Email Address" :tag "Email Address" email) | |
161 (const :menu-tag "Phone" :tag "Phone" phone) | |
162 (symbol :menu-tag "Other" :tag "Attribute name")))) | |
163 :group 'eudc) | |
164 | |
165 (defcustom eudc-expansion-overwrites-query t | |
73650
81ede624c74c
(eudc-expansion-overwrites-query): Use "non-nil" in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
68648
diff
changeset
|
166 "*If non-nil, expanding a query overwrites the query string." |
27313 | 167 :type 'boolean |
168 :group 'eudc) | |
169 | |
170 (defcustom eudc-inline-expansion-format '("%s" email) | |
171 "*A list specifying the format of the expansion of inline queries. | |
172 This variable controls what `eudc-expand-inline' actually inserts in | |
173 the buffer. First element is a string passed to `format'. Remaining | |
174 elements are symbols indicating attribute names; the corresponding values | |
175 are passed as additional arguments to `format'." | |
32229 | 176 :type '(list |
27313 | 177 (string :tag "Format String") |
178 (repeat :inline t | |
179 :tag "Attributes" | |
32229 | 180 (choice |
27313 | 181 :tag "Attribute" |
182 (const :menu-tag "First Name" :tag "First Name" firstname) | |
183 (const :menu-tag "Surname" :tag "Surname" name) | |
184 (const :menu-tag "Email Address" :tag "Email Address" email) | |
185 (const :menu-tag "Phone" :tag "Phone" phone) | |
186 (symbol :menu-tag "Other") | |
187 (symbol :tag "Attribute name")))) | |
188 :group 'eudc) | |
189 | |
190 (defcustom eudc-inline-expansion-servers 'server-then-hotlist | |
191 "*Which servers to contact for the expansion of inline queries. | |
192 Possible values are: | |
193 `current-server': the EUDC current server. | |
194 `hotlist': the servers of the hotlist in the order they appear, | |
32229 | 195 `server-then-hotlist': the current server and then the servers of |
27313 | 196 the hotlist." |
197 :type '(choice :tag "Servers" | |
198 :menu-tag "Servers" | |
199 (const :menu-tag "Current server" current-server) | |
200 (const :menu-tag "Servers in the hotlist" hotlist) | |
201 (const :menu-tag "Current server then hotlist" server-then-hotlist)) | |
202 :group 'eudc) | |
203 | |
204 (defcustom eudc-max-servers-to-query nil | |
205 "*Maximum number of servers to query for an inline expansion. | |
206 If nil, query all servers available from `eudc-inline-expansion-servers'." | |
207 :tag "Max Number of Servers to Query" | |
208 :type '(choice :tag "Max. Servers" | |
209 :menu-tag "Max. Servers" | |
210 (const :menu-tag "No limit" nil) | |
211 (const :menu-tag "1" 1) | |
212 (const :menu-tag "2" 2) | |
213 (const :menu-tag "3" 3) | |
214 (const :menu-tag "4" 4) | |
215 (const :menu-tag "5" 5) | |
216 (integer :menu-tag "Set")) | |
217 :group 'eudc) | |
218 | |
219 (defcustom eudc-query-form-attributes '(name firstname email phone) | |
220 "*A list of attributes presented in the query form." | |
221 :tag "Attributes in Query Forms" | |
32229 | 222 :type '(repeat |
27313 | 223 (choice |
224 :tag "Attribute" | |
225 (const :menu-tag "First Name" :tag "First Name" firstname) | |
226 (const :menu-tag "Surname" :tag "Surname" name) | |
227 (const :menu-tag "Email Address" :tag "Email Address" email) | |
228 (const :menu-tag "Phone" :tag "Phone" phone) | |
229 (symbol :menu-tag "Other" :tag "Attribute name"))) | |
230 :group 'eudc) | |
231 | |
232 (defcustom eudc-user-attribute-names-alist '((url . "URL") | |
233 (callsign . "HAM Call Sign") | |
234 (id . "ID") | |
235 (email . "E-Mail") | |
236 (firstname . "First Name") | |
237 (cn . "Full Name") | |
238 (sn . "Surname") | |
239 (givenname . "First Name") | |
240 (ou . "Unit") | |
241 (labeledurl . "URL") | |
242 (postaladdress . "Address") | |
243 (postalcode . "Postal Code") | |
244 (l . "Location") | |
245 (c . "Country") | |
246 (o . "Organization") | |
247 (roomnumber . "Office") | |
248 (telephonenumber . "Phone") | |
249 (uniqueidentifier . "ID") | |
250 (objectclass . "Object Class")) | |
251 "*Alist of user-defined names for directory attributes. | |
32229 | 252 These names are used as prompt strings in query/response forms |
27313 | 253 instead of the raw directory attribute names. |
254 Prompt strings for attributes that are not listed here | |
255 are derived by splitting the attribute name | |
256 at `_' characters and capitalizing the individual words." | |
257 :tag "User-defined Names of Directory Attributes" | |
258 :type '(repeat (cons :tag "Field" | |
259 (symbol :tag "Directory attribute") | |
260 (string :tag "User friendly name "))) | |
261 :group 'eudc) | |
262 | |
263 (defcustom eudc-use-raw-directory-names nil | |
264 "*If non-nil, use attributes names as defined in the directory. | |
265 Otherwise, directory query/response forms display the user attribute | |
266 names defined in `eudc-user-attribute-names-alist'." | |
267 :type 'boolean | |
268 :group 'eudc) | |
269 | |
270 (defcustom eudc-attribute-display-method-alist nil | |
271 "*An alist specifying methods to display attribute values. | |
272 Each member of the list is of the form (NAME . FUNC) where NAME is a lowercased | |
32229 | 273 string naming a directory attribute (translated according to |
274 `eudc-user-attribute-names-alist' if `eudc-use-raw-directory-names' is | |
275 non-nil) and FUNC a function that will be passed the corresponding | |
27313 | 276 attribute values for display." |
277 :tag "Attribute Decoding Functions" | |
278 :type '(repeat (cons :tag "Attribute" | |
279 (symbol :tag "Name") | |
280 (symbol :tag "Display Function"))) | |
281 :group 'eudc) | |
282 | |
42552
27d9f14cc4af
(eudc-external-viewers): Do not use xv, it is not free.
Pavel Janík <Pavel@Janik.cz>
parents:
38422
diff
changeset
|
283 (defcustom eudc-external-viewers '(("ImageMagick" "display" "-") |
27313 | 284 ("ShowAudio" "showaudio")) |
285 "*A list of viewer program specifications. | |
286 Viewers are programs which can be piped a directory attribute value for | |
32229 | 287 display or arbitrary processing. Each specification is a list whose |
288 first element is a string naming the viewer. The second element is the | |
27313 | 289 executable program which should be invoked, and following elements are |
290 arguments that should be passed to the program." | |
291 :tag "External Viewer Programs" | |
292 :type '(repeat (list :tag "Viewer" | |
293 (string :tag "Name") | |
294 (string :tag "Executable program") | |
295 (repeat | |
296 :tag "Arguments" | |
297 :inline t | |
298 (string :tag "Argument")))) | |
299 :group 'eudc) | |
300 | |
301 (defcustom eudc-options-file "~/.eudc-options" | |
302 "*A file where the `servers' hotlist is stored." | |
303 :type '(file :Tag "File Name:") | |
304 :group 'eudc) | |
305 | |
306 (defcustom eudc-mode-hook nil | |
307 "*Normal hook run on entry to EUDC mode." | |
308 :type '(repeat (sexp :tag "Hook definition")) | |
309 :group 'eudc) | |
310 | |
311 ;;}}} | |
312 | |
313 ;;{{{ PH Custom Group | |
314 | |
32229 | 315 (defgroup eudc-ph nil |
27313 | 316 "Emacs Unified Directory Client - CCSO PH/QI Backend." |
317 :group 'eudc) | |
318 | |
319 (defcustom eudc-ph-bbdb-conversion-alist | |
320 '((name . name) | |
321 (net . email) | |
322 (address . (eudc-bbdbify-address address "Address")) | |
323 (phone . ((eudc-bbdbify-phone phone "Phone") | |
324 (eudc-bbdbify-phone office_phone "Office Phone")))) | |
325 "*A mapping from BBDB to PH/QI fields. | |
326 This is a list of cons cells (BBDB-FIELD . SPEC-OR-LIST) where | |
327 BBDB-FIELD is the name of a field that must be defined in your BBDB | |
328 environment (standard field names are `name', `company', `net', `phone', | |
329 `address' and `notes'). SPEC-OR-LIST is either a single SPEC or a list | |
330 of SPECs. Lists of specs are valid only for the `phone' and `address' | |
331 BBDB fields. SPECs are sexps which are evaluated: | |
332 a string evaluates to itself, | |
333 a symbol evaluates to the symbol value. Symbols naming PH/QI fields | |
334 present in the record evaluate to the value of the field in the record, | |
32229 | 335 a form is evaluated as a function. The argument list may contain PH/QI |
27313 | 336 field names which eval to the corresponding values in the |
337 record. The form evaluation should return something appropriate for | |
338 the particular BBDB-FIELD (see `bbdb-create-internal'). | |
339 `eudc-bbdbify-phone' and `eudc-bbdbify-address' are provided as convenience | |
340 functions to parse phones and addresses." | |
341 :tag "BBDB to PH Field Name Mapping" | |
342 :type '(repeat (cons :tag "Field Name" | |
343 (symbol :tag "BBDB Field") | |
344 (sexp :tag "Conversion Spec"))) | |
345 :group 'eudc-ph) | |
346 | |
347 ;;}}} | |
348 | |
349 ;;{{{ LDAP Custom Group | |
350 | |
32229 | 351 (defgroup eudc-ldap nil |
27313 | 352 "Emacs Unified Directory Client - LDAP Backend." |
353 :group 'eudc) | |
354 | |
355 (defcustom eudc-ldap-bbdb-conversion-alist | |
356 '((name . cn) | |
357 (net . mail) | |
358 (address . (eudc-bbdbify-address postaladdress "Address")) | |
359 (phone . ((eudc-bbdbify-phone telephonenumber "Phone")))) | |
360 "*A mapping from BBDB to LDAP attributes. | |
361 This is a list of cons cells (BBDB-FIELD . SPEC-OR-LIST) where | |
362 BBDB-FIELD is the name of a field that must be defined in your BBDB | |
363 environment (standard field names are `name', `company', `net', `phone', | |
364 `address' and `notes'). SPEC-OR-LIST is either a single SPEC or a list | |
365 of SPECs. Lists of specs are valid only for the `phone' and `address' | |
366 BBDB fields. SPECs are sexps which are evaluated: | |
367 a string evaluates to itself, | |
368 a symbol evaluates to the symbol value. Symbols naming LDAP attributes | |
369 present in the record evaluate to the value of the field in the record, | |
32229 | 370 a form is evaluated as a function. The argument list may contain LDAP |
27313 | 371 field names which eval to the corresponding values in the |
372 record. The form evaluation should return something appropriate for | |
373 the particular BBDB-FIELD (see `bbdb-create-internal'). | |
374 `eudc-bbdbify-phone' and `eudc-bbdbify-address' are provided as convenience | |
375 functions to parse phones and addresses." | |
376 :tag "BBDB to LDAP Attribute Names Mapping" | |
377 :type '(repeat (cons :tag "Field Name" | |
378 (symbol :tag "BBDB Field") | |
379 (sexp :tag "Conversion Spec"))) | |
380 :group 'eudc-ldap) | |
381 | |
382 ;;}}} | |
383 | |
384 ;;{{{ BBDB Custom Group | |
385 | |
32229 | 386 (defgroup eudc-bbdb nil |
27313 | 387 "Emacs Unified Directory Client - BBDB Backend." |
388 :group 'eudc) | |
389 | |
390 (defcustom eudc-bbdb-use-locations-as-attribute-names t | |
391 "If non-nil, BBDB address and phone locations are used as attribute names. | |
392 This has no effect on queries (you can't search for a specific location) | |
42563 | 393 but influences the way records are displayed." |
27313 | 394 :type 'boolean |
395 :group 'eudc-bbdb) | |
396 | |
397 (defcustom eudc-bbdb-enable-substring-matches t | |
398 "If non-nil, authorize substring match in the same way BBDB does. | |
399 Otherwise records must match queries exactly." | |
400 :type 'boolean | |
401 :group 'eudc-bbdb) | |
402 | |
403 ;;}}} | |
404 | |
405 | |
406 (provide 'eudc-vars) | |
407 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
79714
diff
changeset
|
408 ;; arch-tag: 80050575-b838-4246-8ebc-b2d7c5a2e482 |
27313 | 409 ;;; eudc-vars.el ends here |