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

View file

@ -9,34 +9,34 @@ errors.")
;;; Packages ;;; Packages
(def-package! flycheck (def-package! flycheck
: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 ;; 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." "Flycheck buffer on ESC in normal mode."
(when flycheck-mode (when flycheck-mode
(ignore-errors (flycheck-buffer)) (ignore-errors (flycheck-buffer))
nil)) 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. "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 +flycheck-lazy-idle-delay))) (setq-local flycheck-idle-change-delay +flycheck-lazy-idle-delay))))
(add-hook 'flycheck-after-syntax-check-hook #'+flycheck|adjust-syntax-check-eagerness)
(global-flycheck-mode +1)) (global-flycheck-mode +1))
(def-package! flycheck-popup-tip (def-package! flycheck-popup-tip
:commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup) :commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup
:init (add-hook 'flycheck-mode-hook #'+flycheck|init-popups) :init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
:config :config
(setq flycheck-popup-tip-error-prefix "") (setq flycheck-popup-tip-error-prefix "")
(after! evil (after! evil
@ -46,9 +46,10 @@ Done to reduce the load flycheck imposes on the current buffer."
(def-package! flycheck-posframe (def-package! flycheck-posframe
:when (and EMACS26+ (featurep! +childframe)) :when EMACS26+
:when (featurep! +childframe)
:defer t :defer t
:init (add-hook 'flycheck-mode-hook #'+flycheck|init-popups) :init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
:config :config
(setq flycheck-posframe-warning-prefix "" (setq flycheck-posframe-warning-prefix ""
flycheck-posframe-info-prefix "··· " flycheck-posframe-info-prefix "··· "