aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/custom.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/custom.el')
-rw-r--r--lisp/custom.el29
1 files changed, 17 insertions, 12 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index 962336978b1..2d880d23955 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -198,12 +198,16 @@ set to nil, as the value is no longer rogue."
198 (run-hooks 'custom-define-hook) 198 (run-hooks 'custom-define-hook)
199 symbol) 199 symbol)
200 200
201(defmacro defcustom (symbol value doc &rest args) 201(defmacro defcustom (symbol standard doc &rest args)
202 "Declare SYMBOL as a customizable variable that defaults to VALUE. 202 "Declare SYMBOL as a customizable variable.
203SYMBOL is the variable name; it should not be quoted.
204STANDARD is an expression specifying the variable's standard
205value. It should not be quoted. It is evaluated once by
206`defcustom', and the value is assigned to SYMBOL if the variable
207is unbound. The expression itself is also stored, so that
208Customize can re-evaluate it later to get the standard value.
203DOC is the variable documentation. 209DOC is the variable documentation.
204 210
205Neither SYMBOL nor VALUE need to be quoted.
206If SYMBOL is not already bound, initialize it to VALUE.
207The remaining arguments should have the form 211The remaining arguments should have the form
208 212
209 [KEYWORD VALUE]... 213 [KEYWORD VALUE]...
@@ -320,14 +324,15 @@ for more information."
320 `(custom-declare-variable 324 `(custom-declare-variable
321 ',symbol 325 ',symbol
322 ,(if lexical-binding ;FIXME: This is not reliable, but is all we have. 326 ,(if lexical-binding ;FIXME: This is not reliable, but is all we have.
323 ;; The `default' arg should be an expression that evaluates to 327 ;; The STANDARD arg should be an expression that evaluates to
324 ;; the value to use. The use of `eval' for it is spread over 328 ;; the standard value. The use of `eval' for it is spread
325 ;; many different places and hence difficult to eliminate, yet 329 ;; over many different places and hence difficult to
326 ;; we want to make sure that the `value' expression is checked by the 330 ;; eliminate, yet we want to make sure that the `standard'
327 ;; byte-compiler, and that lexical-binding is obeyed, so quote the 331 ;; expression is checked by the byte-compiler, and that
328 ;; expression with `lambda' rather than with `quote'. 332 ;; lexical-binding is obeyed, so quote the expression with
329 `(list (lambda () ,value)) 333 ;; `lambda' rather than with `quote'.
330 `',value) 334 `(list (lambda () ,standard))
335 `',standard)
331 ,doc 336 ,doc
332 ,@args)) 337 ,@args))
333 338