Mercurial > emacs
comparison lispref/customize.texi @ 74703:be5e68ff2673
Use "option" only for user options.
For the keyword values inside defcustom etc, say "keywords".
For :options value's elements, say "elements".
:group should not be omitted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 17 Dec 2006 22:20:40 +0000 |
parents | ebabba7dccfd |
children | 17306b206515 |
comparison
equal
deleted
inserted
replaced
74702:2d3815650232 | 74703:be5e68ff2673 |
---|---|
133 a feature such as a minor mode, and just setting the variable won't have | 133 a feature such as a minor mode, and just setting the variable won't have |
134 any effect unless the code which implements the mode is loaded. | 134 any effect unless the code which implements the mode is loaded. |
135 | 135 |
136 @item :version @var{version} | 136 @item :version @var{version} |
137 @kindex version@r{, customization keyword} | 137 @kindex version@r{, customization keyword} |
138 This option specifies that the item was first introduced in Emacs | 138 This keyword specifies that the item was first introduced in Emacs |
139 version @var{version}, or that its default value was changed in that | 139 version @var{version}, or that its default value was changed in that |
140 version. The value @var{version} must be a string. | 140 version. The value @var{version} must be a string. |
141 | 141 |
142 @item :package-version '(@var{package} . @var{version}) | 142 @item :package-version '(@var{package} . @var{version}) |
143 @kindex package-version@r{, customization keyword} | 143 @kindex package-version@r{, customization keyword} |
144 This option specifies that the item was first introduced in | 144 This keyword specifies that the item was first introduced in |
145 @var{package} version @var{version}, or that its meaning or default | 145 @var{package} version @var{version}, or that its meaning or default |
146 value was changed in that version. The value of @var{package} is a | 146 value was changed in that version. The value of @var{package} is a |
147 symbol and @var{version} is a string. | 147 symbol and @var{version} is a string. |
148 | 148 |
149 This keyword takes priority over @code{:version}. | 149 This keyword takes priority over @code{:version}. |
287 standard value. So be sure to use an expression which is harmless to | 287 standard value. So be sure to use an expression which is harmless to |
288 evaluate at any time. We recommend avoiding backquotes in | 288 evaluate at any time. We recommend avoiding backquotes in |
289 @var{standard}, because they are not expanded when editing the value, | 289 @var{standard}, because they are not expanded when editing the value, |
290 so list values will appear to have the wrong structure. | 290 so list values will appear to have the wrong structure. |
291 | 291 |
292 If you specify the @code{:set} option, to make the variable take other | 292 Every @code{defcustom} should specify @code{:group} at least once. |
293 | |
294 If you specify the @code{:set} keyword, to make the variable take other | |
293 special actions when set through the customization buffer, the | 295 special actions when set through the customization buffer, the |
294 variable's documentation string should tell the user specifically how | 296 variable's documentation string should tell the user specifically how |
295 to do the same job in hand-written Lisp code. | 297 to do the same job in hand-written Lisp code. |
296 | 298 |
297 When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs Lisp | 299 When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs Lisp |
307 @item :type @var{type} | 309 @item :type @var{type} |
308 Use @var{type} as the data type for this option. It specifies which | 310 Use @var{type} as the data type for this option. It specifies which |
309 values are legitimate, and how to display the value. | 311 values are legitimate, and how to display the value. |
310 @xref{Customization Types}, for more information. | 312 @xref{Customization Types}, for more information. |
311 | 313 |
312 @item :options @var{list} | 314 @item :options @var{value-list} |
313 @kindex options@r{, @code{defcustom} keyword} | 315 @kindex options@r{, @code{defcustom} keyword} |
314 Specify @var{list} as the list of reasonable values for use in this | 316 Specify the list of reasonable values for use in this |
315 option. The user is not restricted to using only these values, but they | 317 option. The user is not restricted to using only these values, but they |
316 are offered as convenient alternatives. | 318 are offered as convenient alternatives. |
317 | 319 |
318 This is meaningful only for certain types, currently including | 320 This is meaningful only for certain types, currently including |
319 @code{hook}, @code{plist} and @code{alist}. See the definition of the | 321 @code{hook}, @code{plist} and @code{alist}. See the definition of the |
397 setting this variable until after those others have been handled. Use | 399 setting this variable until after those others have been handled. Use |
398 @code{:set-after} if setting this variable won't work properly unless | 400 @code{:set-after} if setting this variable won't work properly unless |
399 those other variables already have their intended values. | 401 those other variables already have their intended values. |
400 @end table | 402 @end table |
401 | 403 |
402 The @code{:require} option is useful for an option that turns on the | 404 The @code{:require} keyword is useful for an option that turns on the |
403 operation of a certain feature. Assuming that the package is coded to | 405 operation of a certain feature. Assuming that the package is coded to |
404 check the value of the option, you still need to arrange for the package | 406 check the value of the option, you still need to arrange for the package |
405 to be loaded. You can do that with @code{:require}. @xref{Common | 407 to be loaded. You can do that with @code{:require}. @xref{Common |
406 Keywords}. Here is an example, from the library @file{saveplace.el}: | 408 Keywords}. Here is an example, from the library @file{saveplace.el}: |
407 | 409 |
411 :type 'boolean | 413 :type 'boolean |
412 :require 'saveplace | 414 :require 'saveplace |
413 :group 'save-place) | 415 :group 'save-place) |
414 @end example | 416 @end example |
415 | 417 |
416 If a customization item has a type such as @code{hook} or @code{alist}, | 418 If a customization item has a type such as @code{hook} or |
417 which supports @code{:options}, you can add additional options to the | 419 @code{alist}, which supports @code{:options}, you can add additional |
418 item, outside the @code{defcustom} declaration, by calling | 420 values to the list from outside the @code{defcustom} declaration by |
419 @code{custom-add-option}. For example, if you define a function | 421 calling @code{custom-add-option}. For example, if you define a |
420 @code{my-lisp-mode-initialization} intended to be called from | 422 function @code{my-lisp-mode-initialization} intended to be called from |
421 @code{emacs-lisp-mode-hook}, you might want to add that to the list of | 423 @code{emacs-lisp-mode-hook}, you might want to add that to the list of |
422 options for @code{emacs-lisp-mode-hook}, but not by editing its | 424 reasonable values for @code{emacs-lisp-mode-hook}, but not by editing |
423 definition. You can do it thus: | 425 its definition. You can do it thus: |
424 | 426 |
425 @example | 427 @example |
426 (custom-add-option 'emacs-lisp-mode-hook | 428 (custom-add-option 'emacs-lisp-mode-hook |
427 'my-lisp-mode-initialization) | 429 'my-lisp-mode-initialization) |
428 @end example | 430 @end example |
429 | 431 |
430 @defun custom-add-option symbol option | 432 @defun custom-add-option symbol value |
431 To the customization @var{symbol}, add @var{option}. | 433 For the customization option @var{symbol}, add @var{value} to the |
432 | 434 list of reasonable values. |
433 The precise effect of adding @var{option} depends on the customization | 435 |
434 type of @var{symbol}. | 436 The precise effect of adding a value depends on the customization type |
437 of @var{symbol}. | |
435 @end defun | 438 @end defun |
436 | 439 |
437 Internally, @code{defcustom} uses the symbol property | 440 Internally, @code{defcustom} uses the symbol property |
438 @code{standard-value} to record the expression for the standard value, | 441 @code{standard-value} to record the expression for the standard value, |
439 and @code{saved-value} to record the value saved by the user with the | 442 and @code{saved-value} to record the value saved by the user with the |
565 will always be shown in the customize buffer (together with a suitable | 568 will always be shown in the customize buffer (together with a suitable |
566 value), with a checkbox to include or exclude or disable the key/value | 569 value), with a checkbox to include or exclude or disable the key/value |
567 pair from the alist. The user will not be able to edit the keys | 570 pair from the alist. The user will not be able to edit the keys |
568 specified by the @code{:options} keyword argument. | 571 specified by the @code{:options} keyword argument. |
569 | 572 |
570 The argument to the @code{:options} keywords should be a list of option | 573 The argument to the @code{:options} keywords should be a list of |
571 specifications. Ordinarily, the options are simply atoms, which are the | 574 specifications for reasonable keys in the alist. Ordinarily, they are |
572 specified keys. For example: | 575 simply atoms, which stand for themselves as. For example: |
573 | 576 |
574 @smallexample | 577 @smallexample |
575 :options '("foo" "bar" "baz") | 578 :options '("foo" "bar" "baz") |
576 @end smallexample | 579 @end smallexample |
577 | 580 |
578 @noindent | 581 @noindent |
579 specifies that there are three ``known'' keys, namely @code{"foo"}, | 582 specifies that there are three ``known'' keys, namely @code{"foo"}, |
580 @code{"bar"} and @code{"baz"}, which will always be shown first. | 583 @code{"bar"} and @code{"baz"}, which will always be shown first. |
581 | 584 |
582 You may want to restrict the value type for specific keys, for example, | 585 You may want to restrict the value type for specific keys, for |
583 the value associated with the @code{"bar"} key can only be an integer. | 586 example, the value associated with the @code{"bar"} key can only be an |
584 You can specify this by using a list instead of an atom in the option | 587 integer. You can specify this by using a list instead of an atom in |
585 specification. The first element will specify the key, like before, | 588 the list. The first element will specify the key, like before, while |
586 while the second element will specify the value type. | 589 the second element will specify the value type. For example: |
587 | 590 |
588 @smallexample | 591 @smallexample |
589 :options '("foo" ("bar" integer) "baz") | 592 :options '("foo" ("bar" integer) "baz") |
590 @end smallexample | 593 @end smallexample |
591 | 594 |