Function: flymake--mode-line-counter
flymake--mode-line-counter is a byte-compiled function defined in
flymake.el.gz.
Signature
(flymake--mode-line-counter TYPE &optional NO-SPACE)
Documentation
Compute number of diagnostics in buffer with TYPE's severity.
TYPE is usually keyword :error, :warning or :note.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(defun flymake--mode-line-counter (type &optional no-space)
"Compute number of diagnostics in buffer with TYPE's severity.
TYPE is usually keyword `:error', `:warning' or `:note'."
(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 no-space "" '(:propertize " "))
(:propertize
,(format "%d" count)
face ,face
mouse-face mode-line-highlight
keymap
,(let ((map (make-sparse-keymap)))
(define-key map (vector 'mode-line
mouse-wheel-down-event)
(lambda (event)
(interactive "e")
(with-selected-window (posn-window (event-start event))
(flymake-goto-prev-error 1 (list type) t))))
(define-key map (vector 'mode-line
mouse-wheel-up-event)
(lambda (event)
(interactive "e")
(with-selected-window (posn-window (event-start event))
(flymake-goto-next-error 1 (list type) t))))
map))))))