Function: customize-set-variable

customize-set-variable is an autoloaded, interactive and byte-compiled function defined in cus-edit.el.gz.

Signature

(customize-set-variable VARIABLE VALUE &optional COMMENT)

Documentation

Set the default for VARIABLE to VALUE, and return VALUE.

VALUE is a Lisp object.

If VARIABLE has a custom-set property, that is used for setting VARIABLE, otherwise set-default is used.

If VARIABLE has a variable-interactive property, that is used as if it were the arg to interactive (which see) to interactively read the value.

If VARIABLE has a custom-type property, it must be a widget and the
:prompt-value property of that widget will be used for reading the value.

If given a prefix (or a COMMENT argument), also prompt for a comment.

Probably introduced at or before Emacs version 21.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
;;;###autoload
(defun customize-set-variable (variable value &optional comment)
  "Set the default for VARIABLE to VALUE, and return VALUE.
VALUE is a Lisp object.

If VARIABLE has a `custom-set' property, that is used for setting
VARIABLE, otherwise `set-default' is used.

If VARIABLE has a `variable-interactive' property, that is used as if
it were the arg to `interactive' (which see) to interactively read the value.

If VARIABLE has a `custom-type' property, it must be a widget and the
`:prompt-value' property of that widget will be used for reading the value.

If given a prefix (or a COMMENT argument), also prompt for a comment."
  (interactive (custom-prompt-variable "Set variable: "
				       "Set customized value for %s to: "
				       current-prefix-arg))
  (custom-load-symbol variable)
  (custom-push-theme 'theme-value variable 'user 'set (custom-quote value))
  (funcall (or (get variable 'custom-set) #'set-default) variable value)
  (put variable 'customized-value (list (custom-quote value)))
  (cond ((string= comment "")
         (put variable 'variable-comment nil)
         (put variable 'customized-variable-comment nil))
        (comment
         (put variable 'variable-comment comment)
         (put variable 'customized-variable-comment comment)))
  value)