(Variable Definitions): Add `custom-initialize-safe-set' and

`custom-initialize-safe-default'.
`standard-value' is a list too.
(Defining New Types): Use @key{RET} instead of @key{ret}.
This commit is contained in:
Luc Teirlinck 2005-07-14 01:07:23 +00:00
parent fd90b80c17
commit d5b3141dac

View file

@ -12,7 +12,7 @@ and also customization groups for classifying them. We use the term
definitions---as well as face definitions (@pxref{Defining Faces}).
@menu
* Common Keywords:: Common keyword arguments for all kinds of
* Common Keywords:: Common keyword arguments for all kinds of
customization declarations.
* Group Definitions:: Writing customization group definitions.
* Variable Definitions:: Declaring user options.
@ -270,6 +270,22 @@ This is the default @code{:initialize} function.
Use the @code{:set} function to initialize the variable, if it is
already set or has been customized; otherwise, just use
@code{set-default}.
@item custom-initialize-safe-set
@itemx custom-initialize-safe-default
These functions behave like @code{custom-initialize-set}
(@code{custom-initialize-default}, respectively), but catch errors.
If an error occurs during initialization, they set the variable to
@code{nil} using @code{set-default}, and throw no error.
These two functions are only meant for options defined in pre-loaded
files, where some variables or functions used to compute the option's
value may not yet be defined. The option normally gets updated in
@file{startup.el}, ignoring the previously computed value. Because of
this typical usage, the value which these two functions compute
normally only matters when, after startup, one unsets the option's
value and then reevaluates the defcustom. By that time, the necessary
variables and functions will be defined, so there will not be an error.
@end table
@item :set-after @var{variables}
@ -318,8 +334,8 @@ type of @var{symbol}.
Internally, @code{defcustom} uses the symbol property
@code{standard-value} to record the expression for the default value,
and @code{saved-value} to record the value saved by the user with the
customization buffer. The @code{saved-value} property is actually a
list whose car is an expression which evaluates to the value.
customization buffer. Both properties are actually lists whose car is
an expression which evaluates to the value.
@node Customization Types
@section Customization Types
@ -1088,8 +1104,8 @@ widget. For the purpose of defining new customization types, the
argument with the same syntax as the keyword argument to
@code{defcustom} with the same name. The third argument is a
documentation string for the new widget. You will be able to see that
string with the @kbd{M-x widget-browse @key{ret} binary-tree-of-string
@key{ret}} command.
string with the @kbd{M-x widget-browse @key{RET} binary-tree-of-string
@key{RET}} command.
After these mandatory arguments follow the keyword arguments. The most
important is @code{:type}, which describes the data type we want to match