Function: custom-variable-reset-saved

custom-variable-reset-saved is a byte-compiled function defined in cus-edit.el.gz.

Signature

(custom-variable-reset-saved WIDGET)

Documentation

Restore the value of the variable being edited by WIDGET.

If there is a saved value, restore it; otherwise reset to the uncustomized (themed or standard) value.

Update the widget to show that value. The value that was current before this operation becomes the backup value.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-variable-reset-saved (widget)
  "Restore the value of the variable being edited by WIDGET.
If there is a saved value, restore it; otherwise reset to the
uncustomized (themed or standard) value.

Update the widget to show that value.  The value that was current
before this operation becomes the backup value."
  (let* ((symbol (widget-value widget))
	 (saved-value (get symbol 'saved-value))
	 (comment (get symbol 'saved-variable-comment))
         (old-value (custom-variable-current-value widget))
         value)
    (if (not (or saved-value comment))
        (progn
          (setq value (car (get symbol 'standard-value)))
          ;; If there is no saved value, remove the setting.
          (custom-push-theme 'theme-value symbol 'user 'reset)
          ;; And reset this property too.
          (put symbol 'variable-comment nil))
      (setq value (car-safe saved-value))
      (custom-push-theme 'theme-value symbol 'user 'set value)
      (put symbol 'variable-comment comment))
    (unless (equal (eval value) old-value)
      (custom-variable-backup-value widget))
    (ignore-errors
      (funcall (or (get symbol 'custom-set) #'set-default) symbol
               (eval value)))
    (put symbol 'customized-value nil)
    (put symbol 'customized-variable-comment nil)
    (widget-put widget :custom-state 'unknown)
    ;; This call will possibly make the comment invisible
    (custom-redraw widget)))