Function: customize-save-variable

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

Signature

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

Documentation

Set the default for VARIABLE to VALUE, and save it for future sessions.

Return VALUE.

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.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
;;;###autoload
(defun customize-save-variable (variable value &optional comment)
  "Set the default for VARIABLE to VALUE, and save it for future sessions.
Return VALUE.

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 and save variable: "
				       "Set and save value for %s as: "
				       current-prefix-arg))
  (funcall (or (get variable 'custom-set) 'set-default) variable value)
  (put variable 'saved-value (list (custom-quote value)))
  (custom-push-theme 'theme-value variable 'user 'set (custom-quote value))
  (cond ((string= comment "")
         (put variable 'variable-comment nil)
         (put variable 'saved-variable-comment nil))
        (comment
         (put variable 'variable-comment comment)
         (put variable 'saved-variable-comment comment)))
  (put variable 'customized-value nil)
  (put variable 'customized-variable-comment nil)
  (if (custom-file t)
      (custom-save-all)
    (message "Setting `%s' temporarily since \"emacs -q\" would overwrite customizations"
	     variable)
    (set variable value))
  value)