doomemacs/modules/feature/syntax-checker/config.el

45 lines
1.5 KiB
EmacsLisp
Raw Normal View History

;;; feature/syntax-checker/config.el -*- lexical-binding: t; -*-
2017-02-13 05:51:36 -05:00
(def-package! flycheck
2017-02-13 05:51:36 -05:00
:commands (flycheck-mode flycheck-list-errors flycheck-buffer)
:config
;; Emacs feels snappier without checks on newline
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
2017-02-13 05:51:36 -05:00
(after! evil
(defun +syntax-checkers|flycheck-buffer ()
"Flycheck buffer on ESC in normal mode."
2017-05-25 12:22:05 +02:00
(when flycheck-mode
(ignore-errors (flycheck-buffer))
nil))
(add-hook '+evil-esc-hook #'+syntax-checkers|flycheck-buffer t)
;; With the option of flychecking the buffer on escape, so we don't need
;; auto-flychecking on idle-change:
(delq 'idle-change flycheck-check-syntax-automatically)))
2017-02-13 05:51:36 -05:00
;; Long story short, `flycheck-popup-tip' works everywhere but only looks *ok*.
;; `flycheck-pos-tip' looks great, but only in GUI Emacs on Linux. So we want:
;;
;; + GUI Emacs (Linux): pos-tip
;; + GUI Emacs (MacOS): popup-tip
;; + tty Emacs (anywhere): popup-tip
2017-03-19 22:50:52 -04:00
(def-package! flycheck-pos-tip
:commands (flycheck-pos-tip-mode)
2017-02-13 05:51:36 -05:00
:config
(setq flycheck-pos-tip-timeout 10
;; fallback to flycheck-popup-tip in terminal Emacs
flycheck-pos-tip-display-errors-tty-function
#'flycheck-popup-tip-show-popup
flycheck-display-errors-delay 0.5))
(def-package! flycheck-popup-tip
:commands (flycheck-popup-tip-mode flycheck-popup-tip-show-popup))
(after! flycheck
(if IS-MAC
(flycheck-popup-tip)
(flycheck-pos-tip-mode)))