Function: flymake--mode-line-counter-1

flymake--mode-line-counter-1 is a byte-compiled function defined in flymake.el.gz.

Signature

(flymake--mode-line-counter-1 TYPE)

Documentation

Helper for flymake--mode-line-counter.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(defun flymake--mode-line-counter-1 (type)
  "Helper for `flymake--mode-line-counter'."
  (let ((count 0)
        (face (flymake--lookup-type-property type
                                             'mode-line-face
                                             'compilation-error)))
    (dolist (d (flymake-diagnostics))
      (when (= (flymake--severity type)
               (flymake--severity (flymake-diagnostic-type d)))
        (cl-incf count)))
    (when (or (cl-plusp count)
              (cond ((eq flymake-suppress-zero-counters t)
                     nil)
                    (flymake-suppress-zero-counters
                     (>= (flymake--severity type)
                         (warning-numeric-level
                          flymake-suppress-zero-counters)))
                    (t t)))
      `(,(if (eq type :error) "" '(:propertize " "))
        (:propertize
         ,(format "%d" count)
         face ,face
         mouse-face mode-line-highlight
         help-echo ,(format "Number of %s; scroll mouse to view."
                            (cond
                             ((eq type :error) "errors")
                             ((eq type :warning) "warnings")
                             ((eq type :note) "notes")
                             (t (format "%s diagnostics" type))))
         flymake--diagnostic-type ,type
         keymap ,flymake--mode-line-counter-map)))))