diff options
| author | João Távora | 2019-01-05 12:12:00 +0000 |
|---|---|---|
| committer | João Távora | 2019-01-05 12:12:00 +0000 |
| commit | 42c1332494220fab8a07f23f33951edbb01d1c81 (patch) | |
| tree | 3270e760fe3ec7e8d6a5aeea3623719d3989e5b8 | |
| parent | 04d3315271cd1357fbbc192505d00c760be02952 (diff) | |
| download | emacs-42c1332494220fab8a07f23f33951edbb01d1c81.tar.gz emacs-42c1332494220fab8a07f23f33951edbb01d1c81.zip | |
New flymake-supress-zero-counters defcustom
A feature suggested by Yuri Khan <yurivkhan@gmail.com>.
* lisp/progmodes/flymake.el (flymake-suppress-zero-counters): New
variable. (flymake--mode-line-format): Use it.
| -rw-r--r-- | lisp/progmodes/flymake.el | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 14940844a42..d7cb226773c 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -220,6 +220,15 @@ Specifically, start it when the saved buffer is actually displayed." | |||
| 220 | :version "26.1" | 220 | :version "26.1" |
| 221 | :type 'boolean) | 221 | :type 'boolean) |
| 222 | 222 | ||
| 223 | (defcustom flymake-suppress-zero-counters :warning | ||
| 224 | "Control appearance of zero-valued diagnostic counters in mode line. | ||
| 225 | |||
| 226 | If set to t, supress all zero counters. If set to a severity | ||
| 227 | symbol like `:warning' (the default) suppress zero counters less | ||
| 228 | severe than that severity, according to `warning-numeric-level'. | ||
| 229 | If set to nil, don't supress any zero counters." | ||
| 230 | :type 'symbol) | ||
| 231 | |||
| 223 | (when (fboundp 'define-fringe-bitmap) | 232 | (when (fboundp 'define-fringe-bitmap) |
| 224 | (define-fringe-bitmap 'flymake-double-exclamation-mark | 233 | (define-fringe-bitmap 'flymake-double-exclamation-mark |
| 225 | (vector #b00000000 | 234 | (vector #b00000000 |
| @@ -1136,6 +1145,7 @@ default) no filter is applied." | |||
| 1136 | 1145 | ||
| 1137 | (put 'flymake--mode-line-format 'risky-local-variable t) | 1146 | (put 'flymake--mode-line-format 'risky-local-variable t) |
| 1138 | 1147 | ||
| 1148 | |||
| 1139 | (defun flymake--mode-line-format () | 1149 | (defun flymake--mode-line-format () |
| 1140 | "Produce a pretty minor mode indicator." | 1150 | "Produce a pretty minor mode indicator." |
| 1141 | (let* ((known (hash-table-keys flymake--backend-state)) | 1151 | (let* ((known (hash-table-keys flymake--backend-state)) |
| @@ -1203,8 +1213,14 @@ default) no filter is applied." | |||
| 1203 | for face = (flymake--lookup-type-property type | 1213 | for face = (flymake--lookup-type-property type |
| 1204 | 'mode-line-face | 1214 | 'mode-line-face |
| 1205 | 'compilation-error) | 1215 | 'compilation-error) |
| 1206 | when (or diags (>= (flymake--severity type) | 1216 | when (or diags |
| 1207 | (warning-numeric-level :warning))) | 1217 | (cond ((eq flymake-suppress-zero-counters t) |
| 1218 | nil) | ||
| 1219 | (flymake-suppress-zero-counters | ||
| 1220 | (>= (flymake--severity type) | ||
| 1221 | (warning-numeric-level | ||
| 1222 | flymake-suppress-zero-counters))) | ||
| 1223 | (t t))) | ||
| 1208 | collect `(:propertize | 1224 | collect `(:propertize |
| 1209 | ,(format "%d" (length diags)) | 1225 | ,(format "%d" (length diags)) |
| 1210 | face ,face | 1226 | face ,face |