New customization: doom-modeline-checker-simple-format.

If non-nil, only display one number for checker information if applicable.
This commit is contained in:
Vincent Zhang 2019-02-18 01:30:59 +08:00
parent e57c0aa25a
commit 37eef920ec
3 changed files with 30 additions and 14 deletions

View file

@ -163,6 +163,9 @@ Strongly recommend to use
;; If non-nil, a word count will be added to the selection-info modeline segment.
(setq doom-modeline-enable-word-count nil)
;; If non-nil, only display one number for checker information if applicable.
(setq doom-modeline-checker-simple-format t)
;; Whether display perspective name or not. Non-nil to display in mode-line.
(setq doom-modeline-persp-name t)

View file

@ -107,6 +107,9 @@ The icons may not be showed correctly in terminal and on Windows.")
(defvar doom-modeline-enable-word-count nil
"If non-nil, a word count will be added to the selection-info modeline segment.")
(defvar doom-modeline-checker-simple-format t
"If non-nil, only display one number for checker information if applicable.")
(defvar doom-modeline-persp-name t
"Whether display perspective name or not. Non-nil to display in mode-line.")

View file

@ -615,13 +615,18 @@ mouse-2: Show help for minor mode")
(let ((error (or .error 0))
(warning (or .warning 0))
(info (or .info 0)))
(if doom-modeline-checker-simple-format
(doom-modeline-checker-text (number-to-string (+ error warning info))
(cond ((> error 0) 'doom-modeline-urgent)
((> warning 0) 'doom-modeline-warning)
(t 'doom-modeline-info)))
(format "%s/%s/%s"
(doom-modeline-checker-text (number-to-string error)
'doom-modeline-urgent)
(doom-modeline-checker-text (number-to-string warning)
'doom-modeline-warning)
(doom-modeline-checker-text (number-to-string info)
'doom-modeline-info))))))
'doom-modeline-info)))))))
(`running nil)
(`no-checker (doom-modeline-checker-text "-" 'font-lock-doc-face))
(`errored (doom-modeline-checker-text "Error" 'doom-modeline-urgent))
@ -762,13 +767,18 @@ mouse-2: Show help for minor mode"
((null known) (doom-modeline-checker-text "-" 'font-lock-doc-face))
(all-disabled (doom-modeline-checker-text "-" 'doom-modeline-urgent))
(t (when (> (+ .error .warning .note) 0)
(if doom-modeline-checker-simple-format
(doom-modeline-checker-text (number-to-string (+ .error .warning .note))
(cond ((> .error 0) 'doom-modeline-urgent)
((> .warning 0) 'doom-modeline-warning)
(t 'doom-modeline-info)))
(format "%s/%s/%s"
(doom-modeline-checker-text (number-to-string .error)
'doom-modeline-urgent)
(doom-modeline-checker-text (number-to-string .warning)
'doom-modeline-warning)
(doom-modeline-checker-text (number-to-string .note)
'doom-modeline-info)))))))
'doom-modeline-info))))))))
(propertize
text
'help-echo (cond