Function: bytecomp--check-cus-face-spec

bytecomp--check-cus-face-spec is a byte-compiled function defined in bytecomp.el.gz.

Signature

(bytecomp--check-cus-face-spec SPEC)

Documentation

Check for mistakes in a defface SPEC argument.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun bytecomp--check-cus-face-spec (spec)
  "Check for mistakes in a `defface' SPEC argument."
  (when (consp spec)
    (dolist (sp spec)
      (let ((display (car-safe sp))
            (atts (cdr-safe sp)))
        (cond ((listp display)
               (dolist (condition display)
                 (unless (memq (car-safe condition)
                               '(type class background min-colors supports))
                   (bytecomp--cus-warn
                    (list sp spec)
                    "Bad face display condition `%S'" (car condition)))))
              ((not (memq display '(t default)))
               (bytecomp--cus-warn
                (list sp spec) "Bad face display `%S'" display)))
        (when (and (consp atts) (null (cdr atts)))
          (setq atts (car atts)))       ; old (DISPLAY ATTS) syntax
        (while atts
          (let ((attr (car atts))
                (val (cadr atts)))
            (cond
             ((not (keywordp attr))
              (bytecomp--cus-warn
               (list atts sp spec)
               "Non-keyword in face attribute list: `%S'" attr))
             ((null (cdr atts))
              (bytecomp--cus-warn
               (list atts sp spec) "Missing face attribute `%s' value" attr))
             ((memq attr '( :inherit :extend
                            :family :foundry :width :height :weight :slant
                            :foreground :distant-foreground :background
                            :underline :overline :strike-through :box
                            :inverse-video :stipple :font
                            ;; FIXME: obsolete keywords, warn about them too?
                            :bold           ; :bold t   = :weight bold
                            :italic         ; :italic t = :slant italic
                            ))
              (when (eq (car-safe val) 'quote)
                (bytecomp--cus-warn
                 (list val atts sp spec)
                 "Value for face attribute `%s' should not be quoted" attr)))
             ((eq attr :reverse-video)
              (bytecomp--cus-warn
               (list atts sp spec)
               (concat "Face attribute `:reverse-video' has been removed;"
                       " use `:inverse-video' instead")))
             (t
              (bytecomp--cus-warn
               (list atts sp spec)
               "`%s' is not a valid face attribute keyword" attr))))
          (setq atts (cddr atts)))))))