Function: custom-initialize-reset

custom-initialize-reset is a byte-compiled function defined in custom.el.gz.

Signature

(custom-initialize-reset SYMBOL EXP)

Documentation

Initialize SYMBOL based on EXP.

Set the symbol, using its :set function (or set-default-toplevel-value if it has none).

The value is either the symbol's current value
 (as obtained using the :get function), if any,
or the value in the symbol's saved-value property if any, or (last of all) the value of EXP.

Source Code

;; Defined in /usr/src/emacs/lisp/custom.el.gz
(defun custom-initialize-reset (symbol exp)
  "Initialize SYMBOL based on EXP.
Set the symbol, using its `:set' function (or `set-default-toplevel-value'
if it has none).

The value is either the symbol's current value
 (as obtained using the `:get' function), if any,
or the value in the symbol's `saved-value' property if any,
or (last of all) the value of EXP."
  ;; If this value has been set with `setopt' (for instance in
  ;; ~/.emacs), we didn't necessarily know the type of the user option
  ;; then.  So check now, and issue a warning if it's wrong.
  (let ((value (get symbol 'custom-check-value)))
    (when value
      (let ((type (get symbol 'custom-type)))
        (when (and type
                   (boundp symbol)
                   (eq (car value) (symbol-value symbol))
                   ;; Check that the type is correct.
                   (not (widget-apply (widget-convert type)
                                      :match (car value))))
          (warn "Value `%S' for `%s' does not match type %s"
                value symbol type)))))
  (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
           symbol
           (condition-case nil
               (let ((def (default-toplevel-value symbol))
                     (getter (get symbol 'custom-get)))
                 (if getter (funcall getter symbol) def))
             (error
              (eval (let ((sv (get symbol 'saved-value)))
                      (if sv (car sv) exp)))))))