mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Remove +flycheck-on-escape; add +flycheck-lazy-idle-delay
+flycheck-on-escape was redundant with removing +flycheck|buffer from doom-escape-hook. Also, I don't use this pattern anywhere else.
This commit is contained in:
@ -1,7 +1,8 @@
|
|||||||
;;; tools/flycheck/config.el -*- lexical-binding: t; -*-
|
;;; tools/flycheck/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +flycheck-on-escape t
|
(defvar +flycheck-lazy-idle-delay 3.0
|
||||||
"If non-nil, flycheck will recheck the current buffer when pressing ESC/C-g.")
|
"The delay before flycheck checks the buffer, after a check that produces no
|
||||||
|
errors.")
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
@ -17,17 +18,17 @@
|
|||||||
|
|
||||||
(defun +flycheck|buffer ()
|
(defun +flycheck|buffer ()
|
||||||
"Flycheck buffer on ESC in normal mode."
|
"Flycheck buffer on ESC in normal mode."
|
||||||
(when (and flycheck-mode +flycheck-on-escape)
|
(when flycheck-mode
|
||||||
(ignore-errors (flycheck-buffer))
|
(ignore-errors (flycheck-buffer))
|
||||||
nil))
|
nil))
|
||||||
(add-hook 'doom-escape-hook #'+flycheck|buffer t)
|
(add-hook 'doom-escape-hook #'+flycheck|buffer 'append)
|
||||||
|
|
||||||
(defun +flycheck|adjust-syntax-check-eagerness ()
|
(defun +flycheck|adjust-syntax-check-eagerness ()
|
||||||
"Check for errors less often when there aren't any.
|
"Check for errors less often when there aren't any.
|
||||||
Done to reduce the load flycheck imposes on the current buffer."
|
Done to reduce the load flycheck imposes on the current buffer."
|
||||||
(if flycheck-current-errors
|
(if flycheck-current-errors
|
||||||
(kill-local-variable 'flycheck-idle-change-delay)
|
(kill-local-variable 'flycheck-idle-change-delay)
|
||||||
(setq-local flycheck-idle-change-delay 3.0)))
|
(setq-local flycheck-idle-change-delay +flycheck-lazy-idle-delay)))
|
||||||
(add-hook 'flycheck-after-syntax-check-hook #'+flycheck|adjust-syntax-check-eagerness)
|
(add-hook 'flycheck-after-syntax-check-hook #'+flycheck|adjust-syntax-check-eagerness)
|
||||||
|
|
||||||
(global-flycheck-mode +1))
|
(global-flycheck-mode +1))
|
||||||
|
Reference in New Issue
Block a user