diff --git a/modules/tools/flycheck/autoload.el b/modules/tools/flycheck/autoload.el index cc8167c4e..4f3ea2929 100644 --- a/modules/tools/flycheck/autoload.el +++ b/modules/tools/flycheck/autoload.el @@ -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." diff --git a/modules/tools/flycheck/config.el b/modules/tools/flycheck/config.el index 6fee6ed63..e96cd7dbc 100644 --- a/modules/tools/flycheck/config.el +++ b/modules/tools/flycheck/config.el @@ -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 () - "Flycheck buffer on ESC in normal mode." - (when flycheck-mode - (ignore-errors (flycheck-buffer)) - nil)) - (add-hook 'doom-escape-hook #'+flycheck|buffer 'append) + (add-hook 'doom-escape-hook + (defun +flycheck-buffer-h () + "Flycheck buffer on ESC in normal mode." + (when flycheck-mode + (ignore-errors (flycheck-buffer)) + nil)) + 'append) - (defun +flycheck|adjust-syntax-check-eagerness () - "Check for errors less often when there aren't any. + (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) + (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)) (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 "··· "