Function: custom-filter-face-spec

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

Signature

(custom-filter-face-spec SPEC FILTER-INDEX &optional DEFAULT-FILTER)

Documentation

Return a canonicalized version of SPEC.

FILTER-INDEX is the index in the entry for each attribute in custom-face-attributes at which the appropriate filter function can be found, and DEFAULT-FILTER is the filter to apply for attributes that don't specify one.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-filter-face-spec (spec filter-index &optional default-filter)
  "Return a canonicalized version of SPEC.
FILTER-INDEX is the index in the entry for each attribute in
`custom-face-attributes' at which the appropriate filter function can be
found, and DEFAULT-FILTER is the filter to apply for attributes that
don't specify one."
  (mapcar (lambda (entry)
	    ;; Filter a single face-spec entry
	    (let ((tests (car entry))
		  (unfiltered-attrs
		   ;; Handle both old- and new-style attribute syntax
		   (if (listp (car (cdr entry)))
		       (car (cdr entry))
		     (cdr entry)))
		  (filtered-attrs nil))
	      ;; Filter each face attribute
	      (while unfiltered-attrs
		(let* ((attr (pop unfiltered-attrs))
		       (pre-filtered-value (pop unfiltered-attrs))
		       (filter
			(or (nth filter-index (assq attr custom-face-attributes))
			    default-filter))
		       (filtered-value
			(if filter
			    (funcall filter pre-filtered-value)
			  pre-filtered-value)))
		  (push filtered-value filtered-attrs)
		  (push attr filtered-attrs)))
	      ;;
	      (list tests filtered-attrs)))
	  spec))