summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2016-11-20 09:40:19 -0800
committerFranck Cuny <franck.cuny@gmail.com>2016-11-20 09:40:19 -0800
commitd4b476e4541797fa64f205f1440c64a79208efbd (patch)
tree09cb0697b945be4b46038dfc1a45c97fa051d9a1
parent[Emacs] Highlight current line. (diff)
downloademacs.d-d4b476e4541797fa64f205f1440c64a79208efbd.tar.gz
[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.
-rw-r--r--emacs.d/init.el29
1 files 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