From d4b476e4541797fa64f205f1440c64a79208efbd Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 20 Nov 2016 09:40:19 -0800 Subject: [Emacs] Make flycheck more readable in the mode line. This new configuration should be more easy to read, with report for individual errors/warnings/info. For every state other than 'finished', we display the report with ? instead of numbers. --- emacs.d/init.el | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/emacs.d/init.el b/emacs.d/init.el index 16f250d..5051c13 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -192,20 +192,23 @@ :modes (python-mode)) (add-to-list 'flycheck-checkers 'source-check) + (defun fc/flycheck-modeline (errors-count warnings-count info-count) + (concat + (format "•%s " errors-count) + (format "•%s " warnings-count) + (format "•%s " info-count))) + (setq flycheck-mode-line - '(:eval - (pcase flycheck-last-status-change - (`running " ⟲ Running") - (`errored " ⚠ Error") - (`no-checker " ⚠ No Checker") - (`suspicious " ⚠ Suspicious") - (`not-checked " ✖ Disabled") - (`interrupted " ⚠ Interrupted") - (`finished - (let* ((error-counts (flycheck-count-errors flycheck-current-errors)) - (no-errors (cdr (assq 'error error-counts))) - (no-warnings (cdr (assq 'warning error-counts)))) - (if (or no-errors no-warnings) (format " ✘ %s/%s Issues" (or no-errors 0) (or no-warnings 0)) " ✔ No Issues")))))))) + '(:eval + (pcase flycheck-last-status-change + (`finished + (let* ((count (flycheck-count-errors flycheck-current-errors)) + (errors-count (cdr (assq 'error count))) + (warnings-count (cdr (assq 'warning count))) + (info-count (cdr (assq 'info count)))) + (fc/flycheck-modeline (or errors-count 0) (or warnings-count 0) (or info-count 0)))) + ;; the default is to show ? for the count + (_ (fc/flycheck-modeline "?" "?" "?"))))))) (use-package flyspell ;; check the spelling -- cgit 1.4.1