Function: custom-variable-mark-to-reset-standard

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

Signature

(custom-variable-mark-to-reset-standard WIDGET)

Documentation

Mark to restore standard setting for the variable edited by widget WIDGET.

If custom-reset-standard-variables-list is nil, save, reset and redraw the widget immediately.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-variable-mark-to-reset-standard (widget)
  "Mark to restore standard setting for the variable edited by widget WIDGET.
If `custom-reset-standard-variables-list' is nil, save, reset and
redraw the widget immediately."
  (let* ((symbol (widget-value widget)))
    (if (get symbol 'standard-value)
	(unless (equal (custom-variable-current-value widget)
                       (eval (car (get symbol 'standard-value))))
          (custom-variable-backup-value widget))
      (user-error "No standard setting known for %S" symbol))
    (put symbol 'variable-comment nil)
    (put symbol 'customized-value nil)
    (put symbol 'customized-variable-comment nil)
    (custom-push-theme 'theme-value symbol 'user 'reset)
    (custom-theme-recalc-variable symbol)
    (if (and custom-reset-standard-variables-list
	     (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)))
	(progn
	  (put symbol 'saved-value nil)
	  (put symbol 'saved-variable-comment nil)
	  ;; Append this to `custom-reset-standard-variables-list' to
	  ;; have `custom-reset-standard-save-and-update' save setting
	  ;; to the file, update the widget's state, and redraw it.
	  (setq custom-reset-standard-variables-list
		(cons widget custom-reset-standard-variables-list)))
      (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
	(put symbol 'saved-value nil)
	(put symbol 'saved-variable-comment nil)
	(custom-save-all))
      (widget-put widget :custom-state 'unknown)
      ;; This call will possibly make the comment invisible
      (custom-redraw widget))))