tools/flycheck: only check on file save/open

This commit is contained in:
Henrik Lissner 2019-10-19 17:01:10 -04:00
parent 45223b3785
commit 8b5b3deaba
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -12,8 +12,12 @@ errors.")
:commands flycheck-list-errors flycheck-buffer :commands flycheck-list-errors flycheck-buffer
:after-call doom-switch-buffer-hook after-find-file :after-call doom-switch-buffer-hook after-find-file
:config :config
;; new-line checks are a mote excessive; idle checks are more than enough (setq flycheck-emacs-lisp-load-path 'inherit)
(delq! 'new-line flycheck-check-syntax-automatically)
;; Check only when saving or opening files. Newline & idle checks are a mote
;; excessive, especially when that can easily catch code in an incomplete
;; state, so we removed them.
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(add-hook! 'doom-escape-hook :append (add-hook! 'doom-escape-hook :append
(defun +flycheck-buffer-h () (defun +flycheck-buffer-h ()
@ -22,14 +26,6 @@ errors.")
(ignore-errors (flycheck-buffer)) (ignore-errors (flycheck-buffer))
nil))) nil)))
(add-hook! 'flycheck-after-syntax-check-hook
(defun +flycheck-adjust-syntax-check-eagerness-h ()
"Check for errors less often when there aren't any.
Done to reduce the load flycheck imposes on the current buffer."
(if flycheck-current-errors
(kill-local-variable 'flycheck-idle-change-delay)
(setq-local flycheck-idle-change-delay +flycheck-lazy-idle-delay))))
(global-flycheck-mode +1)) (global-flycheck-mode +1))