Function: custom-theme-set-faces

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

Signature

(custom-theme-set-faces THEME &rest ARGS)

Documentation

Apply a list of face specs associated with theme THEME.

THEME should be a theme name (a symbol). The special theme named user refers to user settings applied via Customize.

The remaining ARGS should be a list where each entry is a list of the form:

  (FACE SPEC [NOW [COMMENT]])

FACE should be a face name (a symbol). If FACE is a face alias, the setting refers to the parent face.

SPEC should be a face spec. For details, see defface.

NOW, if present and non-nil, forces the face settings to take immediate effect in the Emacs display; in particular, FACE is initialized as a face if it is not yet one. If NOW is omitted or nil, the caller is responsible for making the settings take effect later, by calling custom-theme-recalc-face or face-spec-recalc.

COMMENT is a string comment about FACE.

This function works by calling custom-push-theme to record each SPEC in each FACE's theme-face property, and in THEME's theme-settings property. If FACE has not already been customized, it also stores SPEC in the saved-face property.

If THEME has a non-nil theme-immediate property, this is equivalent to providing the NOW argument to all faces in the argument list.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-face.el.gz
(defun custom-theme-set-faces (theme &rest args)
  "Apply a list of face specs associated with theme THEME.
THEME should be a theme name (a symbol).  The special theme named
`user' refers to user settings applied via Customize.

The remaining ARGS should be a list where each entry is a list of
the form:

  (FACE SPEC [NOW [COMMENT]])

FACE should be a face name (a symbol).  If FACE is a face alias,
the setting refers to the parent face.

SPEC should be a face spec.  For details, see `defface'.

NOW, if present and non-nil, forces the face settings to take
immediate effect in the Emacs display; in particular, FACE is
initialized as a face if it is not yet one.  If NOW is omitted or
nil, the caller is responsible for making the settings take
effect later, by calling `custom-theme-recalc-face' or
`face-spec-recalc'.

COMMENT is a string comment about FACE.

This function works by calling `custom-push-theme' to record each
SPEC in each FACE's `theme-face' property, and in THEME's
`theme-settings' property.  If FACE has not already been
customized, it also stores SPEC in the `saved-face' property.

If THEME has a non-nil `theme-immediate' property, this is
equivalent to providing the NOW argument to all faces in the
argument list."
  (custom-check-theme theme)
  (let ((immediate (get theme 'theme-immediate)))
    (dolist (entry args)
      (unless (listp entry)
	(error "Incompatible Custom theme spec"))
      (let ((face (car entry))
	    (spec (nth 1 entry)))
	;; If FACE is actually an alias, customize the face it
	;; is aliased to.
	(if (get face 'face-alias)
	    (setq face (get face 'face-alias)))
	(if (not (custom--should-apply-setting theme))
	    ;; Just update theme settings.
	    (custom-push-theme 'theme-face face theme 'set spec)
	  ;; Update theme settings and set the face spec.
	  (let ((now (nth 2 entry))
		(comment (nth 3 entry))
		(oldspec (get face 'theme-face)))
	    (when (not (and oldspec (eq 'user (caar oldspec))))
	      (put face 'saved-face spec)
	      (put face 'saved-face-comment comment))
	    (custom-push-theme 'theme-face face theme 'set spec)
	    (when (or now immediate)
	      (put face 'force-face (if now 'rogue 'immediate)))
	    (when (or now immediate (facep face))
	      (put face 'face-comment comment)
	      (face-spec-set face spec t))))))))