Function: mh-face-data

mh-face-data is a byte-compiled function defined in mh-e.el.gz.

Signature

(mh-face-data FACE &optional INHERIT)

Documentation

Return spec for FACE.

See defface for the spec definition.

If INHERIT is non-nil and defface supports the :inherit keyword, return INHERIT literally; otherwise, return spec for FACE from the variable mh-face-data(var)/mh-face-data(fun). This isn't a perfect implementation. In the case that the :inherit keyword is not supported, any additional attributes in the inherit parameter are not added to the returned spec.

Furthermore, when mh-min-colors-defined-flag is nil, this function finds display entries with "min-colors" requirements and either removes the "min-colors" requirement or strips the display entirely if the display does not support the number of specified colors.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-e.el.gz
(defun mh-face-data (face &optional inherit)
  "Return spec for FACE.
See `defface' for the spec definition.

If INHERIT is non-nil and `defface' supports the :inherit
keyword, return INHERIT literally; otherwise, return spec for
FACE from the variable `mh-face-data'. This isn't a perfect
implementation. In the case that the :inherit keyword is not
supported, any additional attributes in the inherit parameter are
not added to the returned spec.

Furthermore, when `mh-min-colors-defined-flag' is nil, this
function finds display entries with \"min-colors\" requirements
and either removes the \"min-colors\" requirement or strips the
display entirely if the display does not support the number of
specified colors."
  (let ((spec
         (if (and inherit mh-inherit-face-flag)
             inherit
           (or (cadr (assq face mh-face-data))
               (error "Could not find %s in mh-face-data" face)))))

    (if mh-min-colors-defined-flag
        spec
      (let ((cells (mh-display-color-cells))
            new-spec)
        ;; Remove entries with min-colors, or delete them if we have
        ;; fewer colors than they specify.
        (cl-loop
         for entry in (reverse spec) do
         (let ((requirement (if (eq (car entry) t)
                                nil
                              (assq 'min-colors (car entry)))))
           (if requirement
               (when (>= cells (nth 1 requirement))
                 (setq new-spec (cons (cons (delq requirement (car entry))
                                            (cdr entry))
                                      new-spec)))
             (setq new-spec (cons entry new-spec)))))
        new-spec))))