flycheck: use pos-tip in GUI Emacs (linux), popup-tip everywhere else
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
This commit is contained in:
parent
9e3682535a
commit
065091bdca
2 changed files with 27 additions and 21 deletions
|
@ -1,37 +1,44 @@
|
|||
;;; feature/syntax-checker/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; pkg-info doesn't get autoloaded when `flycheck-version' needs it, so we do
|
||||
;; it ourselves:
|
||||
(autoload 'pkg-info-version-info "pkg-info")
|
||||
|
||||
(def-package! flycheck
|
||||
:commands (flycheck-mode flycheck-list-errors flycheck-buffer)
|
||||
:config
|
||||
;; Emacs feels snappier without checks on idle/change
|
||||
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
||||
|
||||
(set! :popup 'flycheck-error-list-mode :select t :autokill t)
|
||||
;; Emacs feels snappier without checks on newline
|
||||
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
|
||||
|
||||
(after! evil
|
||||
;; Flycheck buffer on ESC in normal mode.
|
||||
(defun +syntax-checkers|flycheck-buffer ()
|
||||
"Flycheck buffer on ESC in normal mode."
|
||||
(when flycheck-mode
|
||||
(ignore-errors (flycheck-buffer))
|
||||
nil))
|
||||
(add-hook '+evil-esc-hook #'+syntax-checkers|flycheck-buffer t)))
|
||||
(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)))
|
||||
|
||||
|
||||
;; 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
|
||||
|
||||
(def-package! flycheck-pos-tip
|
||||
:unless IS-MAC
|
||||
:after flycheck
|
||||
:commands (flycheck-pos-tip-mode)
|
||||
:config
|
||||
(setq flycheck-pos-tip-timeout 10
|
||||
flycheck-display-errors-delay 0.5)
|
||||
(flycheck-pos-tip-mode +1))
|
||||
|
||||
;; 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
|
||||
:when IS-MAC
|
||||
:after flycheck
|
||||
:hook (flycheck-mode . flycheck-popup-tip-mode))
|
||||
:commands (flycheck-popup-tip-mode flycheck-popup-tip-show-popup))
|
||||
|
||||
(after! flycheck
|
||||
(if IS-MAC
|
||||
(flycheck-popup-tip)
|
||||
(flycheck-pos-tip-mode)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue