mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-30 11:09:55 +00:00
Optimize performance for flymake segment.
This commit is contained in:
parent
b56a9f233c
commit
30d882b9aa
1 changed files with 9 additions and 5 deletions
|
@ -1130,7 +1130,7 @@ icons."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defvar-local doom-modeline--flymake nil)
|
(defvar-local doom-modeline--flymake nil)
|
||||||
(defun doom-modeline-update-flymake-segment ()
|
(defun doom-modeline-update-flymake-segment (&rest _)
|
||||||
"Update flymake segment via STATUS."
|
"Update flymake segment via STATUS."
|
||||||
(setq flymake--mode-line-format nil) ; remove the lighter of minor mode
|
(setq flymake--mode-line-format nil) ; remove the lighter of minor mode
|
||||||
(setq doom-modeline--flymake
|
(setq doom-modeline--flymake
|
||||||
|
@ -1200,24 +1200,28 @@ wheel-up/wheel-down: Previous/Next warning or error"
|
||||||
(with-selected-window (posn-window (event-start event))
|
(with-selected-window (posn-window (event-start event))
|
||||||
(flymake-goto-next-error 1 '(:error :warning) t))))
|
(flymake-goto-next-error 1 '(:error :warning) t))))
|
||||||
map))))))
|
map))))))
|
||||||
;; (add-hook 'flymake-diagnostic-functions #'doom-modeline-update-flymake-segment)
|
(add-hook 'flymake-mode-hook #'doom-modeline-update-flymake-segment)
|
||||||
;; (add-hook 'flymake-mode-hook #'doom-modeline-update-flymake-segment)
|
(advice-add #'flymake--handle-report :after #'doom-modeline-update-flymake-segment)
|
||||||
|
|
||||||
(doom-modeline-def-segment flymake
|
(doom-modeline-def-segment flymake
|
||||||
"Displays color-coded flymake error status in the current buffer with pretty
|
"Displays color-coded flymake error status in the current buffer with pretty
|
||||||
icons."
|
icons."
|
||||||
(if (doom-modeline--active)
|
(if (doom-modeline--active)
|
||||||
(doom-modeline-update-flymake-segment)
|
doom-modeline--flymake
|
||||||
""))
|
""))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; checker: flymake/flycheck
|
||||||
|
;;
|
||||||
|
|
||||||
(doom-modeline-def-segment checker
|
(doom-modeline-def-segment checker
|
||||||
"Displays color-coded error status in the current buffer with pretty
|
"Displays color-coded error status in the current buffer with pretty
|
||||||
icons."
|
icons."
|
||||||
(when (doom-modeline--active)
|
(when (doom-modeline--active)
|
||||||
(cond ((and (bound-and-true-p flymake-mode)
|
(cond ((and (bound-and-true-p flymake-mode)
|
||||||
(bound-and-true-p flymake--backend-state)) ; only support 26+
|
(bound-and-true-p flymake--backend-state)) ; only support 26+
|
||||||
(doom-modeline-update-flymake-segment))
|
doom-modeline--flymake)
|
||||||
((bound-and-true-p flycheck-mode)
|
((bound-and-true-p flycheck-mode)
|
||||||
doom-modeline--flycheck))))
|
doom-modeline--flycheck))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue