Function: doom-modeline-update-flycheck

doom-modeline-update-flycheck is a natively compiled function defined in doom-modeline-segments.el.

Signature

(doom-modeline-update-flycheck &optional STATUS)

Documentation

Update flycheck via STATUS.

Source Code

;; Defined in /nix/store/1lcicrdd2r4b8rkc91nnn74ymk1jl6yd-emacs-packages-deps/share/emacs/site-lisp/elpa/doom-modeline-20260928.1632/doom-modeline-segments.el
(defun doom-modeline-update-flycheck (&optional status)
  "Update flycheck via STATUS."
  (setq doom-modeline--flycheck
        (when (bound-and-true-p flycheck-mode)
          ;; Ensure status is valid
          ;; `window-state-change-functions' will pass window or frame
          (unless (and status (symbolp status))
            (setq status flycheck-last-status-change))

          (let-alist (doom-modeline--flycheck-count-errors)
            (let* ((vsep (doom-modeline-vspc))
                   (seg (cond
                         ((or (eq doom-modeline-check 'simple)
                              (and doom-modeline--limited-width-p (eq doom-modeline-check 'auto)))
                          (let ((count (+ .error .warning .info)))
                            (pcase status
                              ('finished
                               (if (> count 0)
                                   (let ((face (if (> .error 0) 'doom-modeline-urgent 'doom-modeline-warning)))
                                     (concat
                                      (doom-modeline-check-icon "nf-md-alert_circle_outline" "⚠" "!" face)
                                      vsep
                                      (doom-modeline-check-text (number-to-string count) face)))
                                 (doom-modeline-check-icon "nf-md-check_circle_outline" "✔" "*" 'doom-modeline-info)))
                              ('running
                               (concat
                                (doom-modeline-check-icon "nf-md-timer_sand" "⏳" "*" 'doom-modeline-debug)
                                (when (> count 0)
                                  (concat
                                   vsep
                                   (doom-modeline-check-text (number-to-string count) 'doom-modeline-debug)))))
                              ('no-checker
                               (doom-modeline-check-icon "nf-md-alert_box_outline" "⚠" "-" 'doom-modeline-debug))
                              ('errored
                               (doom-modeline-check-icon "nf-md-alert_box_outline" "⚠" "!" 'doom-modeline-urgent))
                              ('interrupted
                               (doom-modeline-check-icon "nf-md-pause_circle_outline" "⦷" "." 'doom-modeline-debug))
                              ('suspicious
                               (doom-modeline-check-icon "nf-md-file_question_outline" "❓" "?" 'doom-modeline-debug))
                              (_ ""))))
                         ((or (eq doom-modeline-check 'full)
                              (and (not doom-modeline--limited-width-p) (eq doom-modeline-check 'auto)))
                          (concat
                           (doom-modeline-check-icon "nf-md-close_circle_outline" "⮾" "!" 'doom-modeline-urgent)
                           vsep
                           (doom-modeline-check-text (number-to-string .error) 'doom-modeline-urgent)
                           vsep
                           (doom-modeline-check-icon "nf-md-alert_outline" "⚠" "!" 'doom-modeline-warning)
                           vsep
                           (doom-modeline-check-text (number-to-string .warning) 'doom-modeline-warning)
                           vsep
                           (doom-modeline-check-icon "nf-md-information_outline" "🛈" "!" 'doom-modeline-info)
                           vsep
                           (doom-modeline-check-text (number-to-string .info) 'doom-modeline-info)))
                         (t ""))))
              (propertize seg
                          'help-echo (concat "Flycheck\n"
                                             (pcase status
                                               ('finished (format "error: %d, warning: %d, info: %d" .error .warning .info))
                                               ('running "Checking...")
                                               ('no-checker "No Checker")
                                               ('errored "Error")
                                               ('interrupted "Interrupted")
                                               ('suspicious "Suspicious"))
                                             "\nmouse-1: Display minor mode menu\nmouse-2: Show help for minor mode")
                          'mouse-face 'doom-modeline-highlight
                          'local-map (let ((map (make-sparse-keymap)))
                                       (define-key map [mode-line down-mouse-1]
                                         flycheck-mode-menu-map)
                                       (define-key map [mode-line mouse-2]
                                         (lambda ()
                                           (interactive)
                                           (describe-function 'flycheck-mode)))
                                       map)))))))