tools/flycheck: conform to new conventions

This commit is contained in:
Henrik Lissner 2019-07-22 23:31:52 +02:00
parent 7562d29d4b
commit 90f5128de2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 22 additions and 21 deletions

View file

@ -1,7 +1,7 @@
;;; tools/flycheck/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +flycheck|init-popups ()
(defun +flycheck-init-popups-h ()
"Activate `flycheck-posframe-mode' if available and in GUI Emacs.
Activate `flycheck-popup-tip-mode' otherwise.
Do nothing if `lsp-ui-mode' is active and `lsp-ui-sideline-enable' is non-nil."

View file

@ -9,34 +9,34 @@ errors.")
;;; Packages
(def-package! flycheck
:commands (flycheck-list-errors flycheck-buffer)
:after-call (doom-switch-buffer-hook after-find-file)
:commands flycheck-list-errors flycheck-buffer
:after-call doom-switch-buffer-hook after-find-file
:config
;; new-line checks are a mote excessive; idle checks are more than enough
(setq flycheck-check-syntax-automatically
(delq 'new-line flycheck-check-syntax-automatically))
(delq! 'new-line flycheck-check-syntax-automatically)
(defun +flycheck|buffer ()
(add-hook 'doom-escape-hook
(defun +flycheck-buffer-h ()
"Flycheck buffer on ESC in normal mode."
(when flycheck-mode
(ignore-errors (flycheck-buffer))
nil))
(add-hook 'doom-escape-hook #'+flycheck|buffer 'append)
'append)
(defun +flycheck|adjust-syntax-check-eagerness ()
(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)))
(add-hook 'flycheck-after-syntax-check-hook #'+flycheck|adjust-syntax-check-eagerness)
(setq-local flycheck-idle-change-delay +flycheck-lazy-idle-delay))))
(global-flycheck-mode +1))
(def-package! flycheck-popup-tip
:commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup)
:init (add-hook 'flycheck-mode-hook #'+flycheck|init-popups)
:commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
:config
(setq flycheck-popup-tip-error-prefix "")
(after! evil
@ -46,9 +46,10 @@ Done to reduce the load flycheck imposes on the current buffer."
(def-package! flycheck-posframe
:when (and EMACS26+ (featurep! +childframe))
:when EMACS26+
:when (featurep! +childframe)
:defer t
:init (add-hook 'flycheck-mode-hook #'+flycheck|init-popups)
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
:config
(setq flycheck-posframe-warning-prefix ""
flycheck-posframe-info-prefix "··· "