Mercurial > emacs
comparison lispref/customize.texi @ 47783:e297e727596c
(Variable Definitions): Update info on :get and default :initialize function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 07 Oct 2002 22:30:45 +0000 |
parents | a7c081b4fc3c |
children | cd3ad87f8d7a |
comparison
equal
deleted
inserted
replaced
47782:de56ca3f523d | 47783:e297e727596c |
---|---|
240 @code{set-default}. | 240 @code{set-default}. |
241 | 241 |
242 @item :get @var{getfunction} | 242 @item :get @var{getfunction} |
243 Specify @var{getfunction} as the way to extract the value of this | 243 Specify @var{getfunction} as the way to extract the value of this |
244 option. The function @var{getfunction} should take one argument, a | 244 option. The function @var{getfunction} should take one argument, a |
245 symbol, and should return the ``current value'' for that symbol (which | 245 symbol, and should return whatever customize should use as the |
246 need not be the symbol's Lisp value). The default is | 246 ``current value'' for that symbol (which need not be the symbol's Lisp |
247 @code{default-value}. | 247 value). The default is @code{default-value}. |
248 | |
249 You have to really understand the workings of Custom to use | |
250 @code{:get} correctly. It is meant for values that are treated in | |
251 Custom as variables but are not actually stored in Lisp variables. It | |
252 is almost surely a mistake to specify @code{getfunction} for a value | |
253 that really is stored in a Lisp variable. | |
248 | 254 |
249 @item :initialize @var{function} | 255 @item :initialize @var{function} |
250 @var{function} should be a function used to initialize the variable when | 256 @var{function} should be a function used to initialize the variable when |
251 the @code{defcustom} is evaluated. It should take two arguments, the | 257 the @code{defcustom} is evaluated. It should take two arguments, the |
252 symbol and value. Here are some predefined functions meant for use in | 258 symbol and value. Here are some predefined functions meant for use in |
253 this way: | 259 this way: |
254 | 260 |
255 @table @code | 261 @table @code |
256 @item custom-initialize-set | 262 @item custom-initialize-set |
257 Use the variable's @code{:set} function to initialize the variable, but | 263 Use the variable's @code{:set} function to initialize the variable, but |
258 do not reinitialize it if it is already non-void. This is the default | 264 do not reinitialize it if it is already non-void. |
259 @code{:initialize} function. | |
260 | 265 |
261 @item custom-initialize-default | 266 @item custom-initialize-default |
262 Like @code{custom-initialize-set}, but use the function | 267 Like @code{custom-initialize-set}, but use the function |
263 @code{set-default} to set the variable, instead of the variable's | 268 @code{set-default} to set the variable, instead of the variable's |
264 @code{:set} function. This is the usual choice for a variable whose | 269 @code{:set} function. This is the usual choice for a variable whose |
265 @code{:set} function enables or disables a minor mode; with this choice, | 270 @code{:set} function enables or disables a minor mode; with this choice, |
266 defining the variable will not call the minor mode function, but | 271 defining the variable will not call the minor mode function, but |
267 customizing the variable will do so. | 272 customizing the variable will do so. |
268 | 273 |
269 @item custom-initialize-reset | 274 @item custom-initialize-reset |
270 Always use the @code{:set} function to initialize the variable. If the | 275 Always use the @code{:set} function to initialize the variable. If |
271 variable is already non-void, reset it by calling the @code{:set} | 276 the variable is already non-void, reset it by calling the @code{:set} |
272 function using the current value (returned by the @code{:get} method). | 277 function using the current value (returned by the @code{:get} method). |
278 This is the default @code{:initialize} function. | |
273 | 279 |
274 @item custom-initialize-changed | 280 @item custom-initialize-changed |
275 Use the @code{:set} function to initialize the variable, if it is | 281 Use the @code{:set} function to initialize the variable, if it is |
276 already set or has been customized; otherwise, just use | 282 already set or has been customized; otherwise, just use |
277 @code{set-default}. | 283 @code{set-default}. |