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

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

Signature

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

Documentation

Restore widget WIDGET to the face's standard attribute values.

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

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-face-mark-to-reset-standard (widget)
  "Restore widget WIDGET to the face's standard attribute values.
If `custom-reset-standard-faces-list' is nil, save, reset and
redraw the widget immediately."
  (let* ((symbol (widget-value widget))
	 (child (car (widget-get widget :children)))
	 (value (get symbol 'face-defface-spec))
	 (comment-widget (widget-get widget :comment-widget)))
    (unless value
      (user-error "No standard setting for this face"))
    ;; If erasing customizations for the default face, push a fake user setting,
    ;; so that reverting to the default attributes works.
    (custom-push-theme 'theme-face symbol 'user
                       (if (eq symbol 'default) 'set 'reset)
                       (or (not (eq symbol 'default))
                           (get symbol 'custom-face-default-attrs)))
    (face-spec-set symbol value 'reset)
    ;; Remove the fake user setting.
    (custom-push-theme 'theme-face symbol 'user 'reset)
    (put symbol 'face-comment nil)
    (put symbol 'customized-face-comment nil)
    (if (and custom-reset-standard-faces-list
	     (or (get symbol 'saved-face) (get symbol 'saved-face-comment)))
	;; Do this later.
	(progn
	  (put symbol 'saved-face nil)
	  (put symbol 'saved-face-comment nil)
	  ;; Append this to `custom-reset-standard-faces-list' and have
	  ;; `custom-reset-standard-save-and-update' save setting to the
	  ;; file, update the widget's state, and redraw it.
	  (setq custom-reset-standard-faces-list
		(cons widget custom-reset-standard-faces-list)))
      (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
	(put symbol 'saved-face nil)
	(put symbol 'saved-face-comment nil)
	(custom-save-all))
      (widget-value-set child
			(custom-pre-filter-face-spec
			 (list (list t (custom-face-attributes-get
					symbol nil)))))
      ;; This call manages the comment visibility
      (widget-value-set comment-widget "")
      (custom-face-state-set widget)
      (custom-redraw-magic widget))))