Function: custom-theme-add-face

custom-theme-add-face is an interactive and byte-compiled function defined in cus-theme.el.gz.

Signature

(custom-theme-add-face FACE &optional SPEC)

Documentation

Add a widget for FACE (a symbol) to the *New Custom Theme* buffer.

SPEC, if non-nil, should be a face spec to which to set the widget.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cus-theme.el.gz
;;; Theme faces

(defun custom-theme-add-face (face &optional spec)
  "Add a widget for FACE (a symbol) to the *New Custom Theme* buffer.
SPEC, if non-nil, should be a face spec to which to set the widget."
  (interactive (list (read-face-name "Face name" (face-at-point t))))
  (unless (or (facep face) spec)
    (error "`%s' has no face definition" face))
  (let ((entry (assq face custom-theme-faces)))
    (cond ((null entry)
	   ;; If FACE is not yet in the buffer, add it.
	   (save-excursion
	     (goto-char custom-theme-insert-face-marker)
	     (custom-theme-add-face-1 face spec)
	     (move-marker custom-theme-insert-face-marker (point))
	     (widget-setup)))
	  ;; Otherwise, if SPEC is supplied, alter that face widget.
	  (spec
	   (widget-value-set (nth 1 entry) t)
	   (let ((widget (nth 2 entry)))
	     (widget-put widget :shown-value spec)
	     (custom-redraw widget)))
	  ((called-interactively-p 'interactive)
	   (error "`%s' is already present" face)))))