[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Declaring Variables

Use defcustom to declare user editable variables.

Function: defcustom symbol value doc [keyword value]...
Declare symbol as a customizable variable that defaults to value. Neither symbol nor value needs to be quoted. If symbol is not already bound, initialize it to value.

doc is the variable documentation.

The following additional keyword's are defined:

:type
value should be a widget type.

:options
value should be a list of possible members of the specified type. For hooks, this is a list of function names.

:initialize
value should be a function used to initialize the variable. It takes two arguments, the symbol and value given in the defcustom call. Some predefined functions are:

custom-initialize-set
Use the :set method to initialize the variable. Do not initialize it if already bound. This is the default :initialize method.

custom-initialize-default
Always use set-default to initialize the variable, even if a :set method has been specified.

custom-initialize-reset
If the variable is already bound, reset it by calling the :set method with the value returned by the :get method.

custom-initialize-changed
Like custom-initialize-reset, but use set-default to initialize the variable if it is not bound and has not been set already.

:set
value should be a function to set the value of the symbol. It takes two arguments, the symbol to set and the value to give it. The default is set-default.

:get
value should be a function to extract the value of symbol. The function takes one argument, a symbol, and should return the current value for that symbol. The default is default-value.

:require
value should be a feature symbol. Each feature will be required when the `defcustom' is evaluated, or when Emacs is started if the user has saved this option.

See section `Sexp Types' in The Widget Library, for information about widgets to use together with the :type keyword.

Internally, custom uses the symbol property custom-type to keep track of the variables type, standard-value for the program specified default value, saved-value for a value saved by the user, and variable-documentation for the documentation string.

Use custom-add-option to specify that a specific function is useful as a member of a hook.

Function: custom-add-option symbol option
To the variable symbol add option.

If symbol is a hook variable, option should be a hook member. For other types of variables, the effect is undefined."


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by XEmacs Webmaster on March, 12 2006 using texi2html