Function: custom-face-set

custom-face-set is a byte-compiled function defined in cus-edit.el.gz.

Signature

(custom-face-set WIDGET)

Documentation

Make the face attributes in WIDGET take effect.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-face-set (widget)
  "Make the face attributes in WIDGET take effect."
  (let* ((symbol (widget-value widget))
	 (value  (custom-face-widget-to-spec widget))
	 (comment-widget (widget-get widget :comment-widget))
	 (comment (widget-value comment-widget)))
    (when (equal comment "")
      (setq comment nil)
      ;; Make the comment invisible by hand if it's empty
      (custom-comment-hide comment-widget))
    ;; When modifying the default face, we need to save the standard or themed
    ;; attrs, in case the user asks to revert to them in the future.
    ;; In GUIs, when resetting the attributes of the default face, the frame
    ;; parameters associated with this face won't change, unless explicitly
    ;; passed a value.  Storing this known attrs allows us to tell faces.el to
    ;; set those attributes to specified values, making the relevant frame
    ;; parameters stay in sync with the default face.
    (when (and (eq symbol 'default)
               (not (get symbol 'custom-face-default-attrs))
               (memq (custom-face-state symbol) '(standard themed)))
      (put symbol 'custom-face-default-attrs
           (custom-face-get-current-spec symbol)))
    (custom-push-theme 'theme-face symbol 'user 'set value)
    (face-spec-set symbol value 'customized-face)
    (put symbol 'face-comment comment)
    (put symbol 'customized-face-comment comment)
    (custom-face-state-set widget)
    (custom-redraw-magic widget)))