doomemacs/modules/feature/syntax-checker/config.el
Henrik Lissner e05d7cfee0
Change flycheck initialization strategy
Initialize it globally and turn it off where needed, instead of enabling
it on demand. Also fixes void-function: flycheck-mode errors when
:feature syntax-checker is disabled. This is experimental.

Indirectly fixes #710
2018-06-22 01:49:20 +02:00

35 lines
1.2 KiB
EmacsLisp

;;; feature/syntax-checker/config.el -*- lexical-binding: t; -*-
(def-package! flycheck
:commands (flycheck-list-errors flycheck-buffer)
:after-call (after-find-file doom-before-switch-buffer)
:config
;; Emacs feels snappier without checks on newline
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
(after! evil
(defun +syntax-checkers|flycheck-buffer ()
"Flycheck buffer on ESC in normal mode."
(when flycheck-mode
(ignore-errors (flycheck-buffer))
nil))
(add-hook 'doom-escape-hook #'+syntax-checkers|flycheck-buffer t)
(add-hook 'evil-insert-state-exit-hook #'+syntax-checkers|flycheck-buffer))
(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 #'+syntax-checker-popup-mode)
:config (setq flycheck-popup-tip-error-prefix ""))
(def-package! flycheck-posframe
:when (and EMACS26+ (featurep! +childframe))
:commands flycheck-posframe-show-posframe
:config
(setq flycheck-posframe-warning-prefix ""
flycheck-posframe-info-prefix "··· "
flycheck-posframe-error-prefix ""))