Mercurial > emacs
comparison lispref/customize.texi @ 22138:d4ac295a98b3
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 19 May 1998 03:45:57 +0000 |
parents | 90da2489c498 |
children | 40089afa2b1d |
comparison
equal
deleted
inserted
replaced
22137:2b0e6a1e7fb9 | 22138:d4ac295a98b3 |
---|---|
29 in a given item. Each use of the keyword has an independent effect. | 29 in a given item. Each use of the keyword has an independent effect. |
30 The keyword @code{:tag} is an exception because any given item can only | 30 The keyword @code{:tag} is an exception because any given item can only |
31 display one name. | 31 display one name. |
32 | 32 |
33 @table @code | 33 @table @code |
34 @item :tag @var{name} | |
35 Use @var{name}, a string, instead of the item's name, to label the item | |
36 in customization menus and buffers. | |
37 | |
34 @item :group @var{group} | 38 @item :group @var{group} |
35 Put this customization item in group @var{group}. When you use | 39 Put this customization item in group @var{group}. When you use |
36 @code{:group} in a @code{defgroup}, it makes the new group a subgroup of | 40 @code{:group} in a @code{defgroup}, it makes the new group a subgroup of |
37 @var{group}. | 41 @var{group}. |
38 | 42 |
46 other documentation. | 50 other documentation. |
47 | 51 |
48 There are three alternatives you can use for @var{link-data}: | 52 There are three alternatives you can use for @var{link-data}: |
49 | 53 |
50 @table @code | 54 @table @code |
51 @item :tag @var{name} | |
52 Use @var{name}, a string, instead of the item's name, to label the item | |
53 in customization menus and buffers. | |
54 | |
55 @item (custom-manual @var{info-node}) | 55 @item (custom-manual @var{info-node}) |
56 Link to an Info node; @var{info-node} is a string which specifies the | 56 Link to an Info node; @var{info-node} is a string which specifies the |
57 node name, as in @code{"(emacs)Top"}. The link appears as | 57 node name, as in @code{"(emacs)Top"}. The link appears as |
58 @samp{[manual]} in the customization buffer. | 58 @samp{[manual]} in the customization buffer. |
59 | 59 |
107 many), and add your group to each of them using the @code{:group} | 107 many), and add your group to each of them using the @code{:group} |
108 keyword. | 108 keyword. |
109 | 109 |
110 The way to declare new customization groups is with @code{defgroup}. | 110 The way to declare new customization groups is with @code{defgroup}. |
111 | 111 |
112 @defmac defgroup group members doc [keyword value]... | |
112 @tindex defgroup | 113 @tindex defgroup |
113 @defmac defgroup group members doc [keyword value]... | |
114 Declare @var{group} as a customization group containing @var{members}. | 114 Declare @var{group} as a customization group containing @var{members}. |
115 Do not quote the symbol @var{group}. The argument @var{doc} specifies | 115 Do not quote the symbol @var{group}. The argument @var{doc} specifies |
116 the documentation string for the group. | 116 the documentation string for the group. |
117 | 117 |
118 The arguments @var{members} can be an alist whose elements specify | 118 The argument @var{members} is a list specifying an initial set of |
119 customization items to be members of the group; however, normally | 119 customization items to be members of the group. However, most often |
120 @var{members} is @code{nil}, and you specify the group's members by | 120 @var{members} is @code{nil}, and you specify the group's members by |
121 using the @code{:group} keyword when defining those members. | 121 using the @code{:group} keyword when defining those members. |
122 | 122 |
123 @ignore | 123 If you want to specify group members through @var{members}, each element |
124 @code{(@var{name} @var{widget})}. Here @var{name} is a symbol, and | 124 should have the form @code{(@var{name} @var{widget})}. Here @var{name} |
125 @var{widget} is a widget for editing that symbol. Useful widgets are | 125 is a symbol, and @var{widget} is a widget type for editing that symbol. |
126 @code{custom-variable} for editing variables, @code{custom-face} for | 126 Useful widgets are @code{custom-variable} for a variable, |
127 editing faces, and @code{custom-group} for editing groups. | 127 @code{custom-face} for a face, and @code{custom-group} for a group. |
128 @end ignore | |
129 | 128 |
130 In addition to the common keywords (@pxref{Common Keywords}), you can | 129 In addition to the common keywords (@pxref{Common Keywords}), you can |
131 use this keyword in @code{defgroup}: | 130 use this keyword in @code{defgroup}: |
132 | 131 |
133 @table @code | 132 @table @code |
160 @node Variable Definitions | 159 @node Variable Definitions |
161 @section Defining Customization Variables | 160 @section Defining Customization Variables |
162 | 161 |
163 Use @code{defcustom} to declare user-editable variables. | 162 Use @code{defcustom} to declare user-editable variables. |
164 | 163 |
164 @defmac defcustom option default doc [keyword value]... | |
165 @tindex defcustom | 165 @tindex defcustom |
166 @defmac defcustom option default doc [keyword value]... | |
167 Declare @var{option} as a customizable user option variable. Do not | 166 Declare @var{option} as a customizable user option variable. Do not |
168 quote @var{option}. The argument @var{doc} specifies the documentation | 167 quote @var{option}. The argument @var{doc} specifies the documentation |
169 string for the variable. | 168 string for the variable. |
170 | 169 |
171 If @var{option} is void, @code{defcustom} initializes it to | 170 If @var{option} is void, @code{defcustom} initializes it to |
172 @var{default}. @var{default} should be an expression to compute the | 171 @var{default}. @var{default} should be an expression to compute the |
173 value; be careful in writing it, because it can be be evaluated on more | 172 value; be careful in writing it, because it can be evaluated on more |
174 than one occasion. | 173 than one occasion. |
175 | 174 |
176 The following additional keywords are defined: | 175 The following additional keywords are accepted: |
177 | 176 |
178 @table @code | 177 @table @code |
179 @item :type @var{type} | 178 @item :type @var{type} |
180 Use @var{type} as the data type for this option. It specifies which | 179 Use @var{type} as the data type for this option. It specifies which |
181 values are legitimate, and how to display the value. | 180 values are legitimate, and how to display the value. |
189 case, the elements of @var{list} should be functions that are useful as | 188 case, the elements of @var{list} should be functions that are useful as |
190 elements of the hook value. The user is not restricted to using only | 189 elements of the hook value. The user is not restricted to using only |
191 these functions, but they are offered as convenient alternatives. | 190 these functions, but they are offered as convenient alternatives. |
192 | 191 |
193 @item :version @var{version} | 192 @item :version @var{version} |
194 This option specifies that the variable's default value was changed in | 193 This option specifies that the variable was first introduced, or its |
195 Emacs version @var{version}. For example, | 194 default value was changed, in Emacs version @var{version}. The value |
195 @var{version} must be a string. For example, | |
196 | 196 |
197 @example | 197 @example |
198 (defcustom foo-max 34 | 198 (defcustom foo-max 34 |
199 "*Maximum number of foo's allowed." | 199 "*Maximum number of foo's allowed." |
200 :type 'integer | 200 :type 'integer |
258 | 258 |
259 @example | 259 @example |
260 (defcustom show-paren-mode nil | 260 (defcustom show-paren-mode nil |
261 "Toggle Show Paren mode@enddots{}" | 261 "Toggle Show Paren mode@enddots{}" |
262 :set (lambda (symbol value) | 262 :set (lambda (symbol value) |
263 (show-paren-mode (or value 0))) | 263 (show-paren-mode (or value 0))) |
264 :initialize 'custom-initialize-default | 264 :initialize 'custom-initialize-default |
265 :type 'boolean | 265 :type 'boolean |
266 :group 'paren-showing | 266 :group 'paren-showing |
267 :require 'paren) | 267 :require 'paren) |
268 @end example | 268 @end example |
367 | 367 |
368 @item directory | 368 @item directory |
369 The value must be a directory name, and you can do completion with | 369 The value must be a directory name, and you can do completion with |
370 @kbd{M-@key{TAB}}. | 370 @kbd{M-@key{TAB}}. |
371 | 371 |
372 @item hook | |
373 The value must be a list of functions (or a single function, but that is | |
374 obsolete usage). This customization type is used for hook variables. | |
375 You can use the @code{:option} in the @code{defcustom} for a hook | |
376 variable to specify functions recommended for use in the hook; | |
377 see @ref{Variable Definitions}. | |
378 | |
372 @item symbol | 379 @item symbol |
373 The value must be a symbol. It appears in the customization buffer as | 380 The value must be a symbol. It appears in the customization buffer as |
374 the name of the symbol. | 381 the name of the symbol. |
375 | 382 |
376 @item function | 383 @item function |
378 it is a function name, you can do completion with @kbd{M-@key{TAB}}. | 385 it is a function name, you can do completion with @kbd{M-@key{TAB}}. |
379 | 386 |
380 @item variable | 387 @item variable |
381 The value must be a variable name, and you can do completion with | 388 The value must be a variable name, and you can do completion with |
382 @kbd{M-@key{TAB}}. | 389 @kbd{M-@key{TAB}}. |
390 | |
391 @item face | |
392 The value must be a symbol which is a face name, and you can do | |
393 completion with @kbd{M-@key{TAB}}. | |
383 | 394 |
384 @item boolean | 395 @item boolean |
385 The value is boolean---either @code{nil} or @code{t}. Note that by | 396 The value is boolean---either @code{nil} or @code{t}. Note that by |
386 using @code{choice} and @code{const} together (see the next section), | 397 using @code{choice} and @code{const} together (see the next section), |
387 you can specify that the value must be @code{nil} or @code{t}, but also | 398 you can specify that the value must be @code{nil} or @code{t}, but also |
397 doing that: | 408 doing that: |
398 | 409 |
399 @table @code | 410 @table @code |
400 @item (restricted-sexp :match-alternatives @var{criteria}) | 411 @item (restricted-sexp :match-alternatives @var{criteria}) |
401 The value may be any Lisp object that satisfies one of @var{criteria}. | 412 The value may be any Lisp object that satisfies one of @var{criteria}. |
402 @var{criteria} should be a list, and each elements should be | 413 @var{criteria} should be a list, and each element should be |
403 one of these possibilities: | 414 one of these possibilities: |
404 | 415 |
405 @itemize @bullet | 416 @itemize @bullet |
406 @item | 417 @item |
407 A predicate---that is, a function of one argument that returns non-@code{nil} | 418 A predicate---that is, a function of one argument that has no side |
408 if the argument fits a certain type. This means that objects of that type | 419 effects, and returns either @code{nil} or non-@code{nil} according to |
409 are acceptable. | 420 the argument. Using a predicate in the list says that objects for which |
421 the predicate returns non-@code{nil} are acceptable. | |
410 | 422 |
411 @item | 423 @item |
412 A quoted constant---that is, @code{'@var{object}}. This means that | 424 A quoted constant---that is, @code{'@var{object}}. This sort of element |
413 @var{object} itself is an acceptable value. | 425 in the list says that @var{object} itself is an acceptable value. |
414 @end itemize | 426 @end itemize |
415 | 427 |
416 For example, | 428 For example, |
417 | 429 |
418 @example | 430 @example |
419 (restricted-sexp :match-alternatives (integerp 't 'nil)) | 431 (restricted-sexp :match-alternatives |
432 (integerp 't 'nil)) | |
420 @end example | 433 @end example |
421 | 434 |
422 @noindent | 435 @noindent |
423 allows integers, @code{t} and @code{nil} as legitimate values. | 436 allows integers, @code{t} and @code{nil} as legitimate values. |
424 | 437 |
425 The customization buffer shows all legitimate values using their read | 438 The customization buffer shows all legitimate values using their read |
426 syntax, and the user edits them textually. | 439 syntax, and the user edits them textually. |
427 | 440 |
428 @item (cons @var{car-type} @var{cdr-type}) | 441 @item (cons @var{car-type} @var{cdr-type}) |
429 The value must be a cons cell, its @sc{car} must fit @var{car-type}, and | 442 The value must be a cons cell, its @sc{car} must fit @var{car-type}, and |
430 its @sc{cdr} must fit @var{cdr-type}. For example, @code{(const string | 443 its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string |
431 symbol)} is a customization type which matches values such as | 444 symbol)} is a customization type which matches values such as |
432 @code{("foo" . foo)}. | 445 @code{("foo" . foo)}. |
433 | 446 |
434 In the customization buffer, the @sc{car} and the @sc{cdr} are | 447 In the customization buffer, the @sc{car} and the @sc{cdr} are |
435 displayed and edited separately, each according to the type | 448 displayed and edited separately, each according to the type |
442 | 455 |
443 For example, @code{(list integer string function)} describes a list of | 456 For example, @code{(list integer string function)} describes a list of |
444 three elements; the first element must be an integer, the second a | 457 three elements; the first element must be an integer, the second a |
445 string, and the third a function. | 458 string, and the third a function. |
446 | 459 |
447 In the customization buffer, the each element is displayed and edited | 460 In the customization buffer, each element is displayed and edited |
448 separately, according to the type specified for it. | 461 separately, according to the type specified for it. |
449 | 462 |
450 @item (vector @var{element-types}@dots{}) | 463 @item (vector @var{element-types}@dots{}) |
451 Like @code{list} except that the value must be a vector instead of a | 464 Like @code{list} except that the value must be a vector instead of a |
452 list. The elements work the same as in @code{list}. | 465 list. The elements work the same as in @code{list}. |
464 choices; however, you can specify different strings for the menu by | 477 choices; however, you can specify different strings for the menu by |
465 including the @code{:tag} keyword in the alternatives. For example, if | 478 including the @code{:tag} keyword in the alternatives. For example, if |
466 an integer stands for a number of spaces, while a string is text to use | 479 an integer stands for a number of spaces, while a string is text to use |
467 verbatim, you might write the customization type this way, | 480 verbatim, you might write the customization type this way, |
468 | 481 |
469 @smallexample | 482 @example |
470 (choice (integer :tag "Number of spaces") | 483 (choice (integer :tag "Number of spaces") |
471 (string :tag "Literal text")) | 484 (string :tag "Literal text")) |
472 @end smallexample | 485 @end example |
473 | 486 |
474 @noindent | 487 @noindent |
475 so that the menu offers @samp{Number of spaces} and @samp{Literal Text}. | 488 so that the menu offers @samp{Number of spaces} and @samp{Literal Text}. |
476 | 489 |
477 In any alternative for which @code{nil} is not a valid value, other than | 490 In any alternative for which @code{nil} is not a valid value, other than |
486 @code{nil}. | 499 @code{nil}. |
487 | 500 |
488 @code{:tag} is often used with @code{const}, inside of @code{choice}. | 501 @code{:tag} is often used with @code{const}, inside of @code{choice}. |
489 For example, | 502 For example, |
490 | 503 |
491 @smallexample | 504 @example |
492 (choice (const :tag "Yes" t) | 505 (choice (const :tag "Yes" t) |
493 (const :tag "No" nil) | 506 (const :tag "No" nil) |
494 (const :tag "Ask" foo)) | 507 (const :tag "Ask" foo)) |
495 @end smallexample | 508 @end example |
496 | 509 |
497 @item (function-item @var{function}) | 510 @item (function-item @var{function}) |
498 Like @code{const}, but used for values which are functions. This | 511 Like @code{const}, but used for values which are functions. This |
499 displays the documentation string as well as the function name. | 512 displays the documentation string as well as the function name. |
500 The documentation string is either the one you specify with | 513 The documentation string is either the one you specify with |
731 When on a widget with no tabbing order specified, go to the next widget | 744 When on a widget with no tabbing order specified, go to the next widget |
732 in the buffer with a positive tabbing order, or @code{nil} | 745 in the buffer with a positive tabbing order, or @code{nil} |
733 @end enumerate | 746 @end enumerate |
734 | 747 |
735 @item :parent | 748 @item :parent |
736 The parent of a nested widget (e.g. a @code{menu-choice} item or an | 749 The parent of a nested widget (e.g., a @code{menu-choice} item or an |
737 element of a @code{editable-list} widget). | 750 element of a @code{editable-list} widget). |
738 | 751 |
739 @item :sibling-args | 752 @item :sibling-args |
740 This keyword is only used for members of a @code{radio-button-choice} or | 753 This keyword is only used for members of a @code{radio-button-choice} or |
741 @code{checklist}. The value should be a list of extra keyword | 754 @code{checklist}. The value should be a list of extra keyword |