[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 42c1332: New flymake-supress-zero-counters defcusto

From: Joo Tvora
Subject: [Emacs-diffs] master 42c1332: New flymake-supress-zero-counters defcustom
Date: Sat, 5 Jan 2019 07:12:42 -0500 (EST)

branch: master
commit 42c1332494220fab8a07f23f33951edbb01d1c81
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    New flymake-supress-zero-counters defcustom
    A feature suggested by Yuri Khan <address@hidden>.
    * lisp/progmodes/flymake.el (flymake-suppress-zero-counters): New
    variable.  (flymake--mode-line-format): Use it.
 lisp/progmodes/flymake.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 1494084..d7cb226 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -220,6 +220,15 @@ Specifically, start it when the saved buffer is actually 
   :version "26.1"
   :type 'boolean)
+(defcustom flymake-suppress-zero-counters :warning
+  "Control appearance of zero-valued diagnostic counters in mode line.
+If set to t, supress all zero counters.  If set to a severity
+symbol like `:warning' (the default) suppress zero counters less
+severe than that severity, according to `warning-numeric-level'.
+If set to nil, don't supress any zero counters."
+  :type 'symbol)
 (when (fboundp 'define-fringe-bitmap)
   (define-fringe-bitmap 'flymake-double-exclamation-mark
     (vector #b00000000
@@ -1136,6 +1145,7 @@ default) no filter is applied."
 (put 'flymake--mode-line-format 'risky-local-variable t)
 (defun flymake--mode-line-format ()
   "Produce a pretty minor mode indicator."
   (let* ((known (hash-table-keys flymake--backend-state))
@@ -1203,8 +1213,14 @@ default) no filter is applied."
            for face = (flymake--lookup-type-property type
-           when (or diags (>= (flymake--severity type)
-                              (warning-numeric-level :warning)))
+           when (or diags
+                    (cond ((eq flymake-suppress-zero-counters t)
+                           nil)
+                          (flymake-suppress-zero-counters
+                           (>= (flymake--severity type)
+                               (warning-numeric-level
+                                flymake-suppress-zero-counters)))
+                          (t t)))
            collect `(:propertize
                      ,(format "%d" (length diags))
                      face ,face

reply via email to

[Prev in Thread] Current Thread [Next in Thread]