Use defcustom
to declare user editable variables.
If option is void, defcustom
initializes it to value.
The argument doc specifies the documentation string for the variable.
The following additional keywords are defined:
:type type
:options list
hook
. The
elements of list are functions that you might likely want to use
as elements of the hook value. The user is not actually restricted to
using only these functions, but they are offered as convenient
alternatives.
:set setfunction
set-default
.
:get getfunction
default-value
.
:initialize function
defcustom
is evaluated. It should take two arguments, the
symbol and value. Here are some predefined functions meant for use in
this way:
custom-initialize-set
:set
function to initialize the variable. Do
not reinitialize it if it is already non-void. This is the default
:initialize
function.
custom-initialize-default
set-default
to initialize the variable, even if some
other :set
function has been specified.
custom-initialize-reset
:set
function using the current value (returned by the
:get
method).
custom-initialize-changed
custom-initialize-reset
, except use set-default
(rather than the :set
function) to initialize the variable if it
is not bound and has not been set already.
:require feature
(require feature)
after installing the saved value.
The place to use this feature is for an option that turns on the
operation of a certain feature. Assuming that the package is coded to
check the value of the option, you still need to arrange for the package
to be loaded. That is what :require
is for.
Internally, defcustom
uses the symbol property
standard-value
to record the expression for the default value,
and saved-value
to record the value saved by the user with the
customization buffer. The saved-value
property is actually a
list whose car is an expression which evaluates to the value.
Go to the first, previous, next, last section, table of contents.