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; -*-
|
;;; 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
|
(def-package! flycheck
|
||||||
:commands (flycheck-mode flycheck-list-errors flycheck-buffer)
|
:commands (flycheck-mode flycheck-list-errors flycheck-buffer)
|
||||||
:config
|
:config
|
||||||
;; Emacs feels snappier without checks on idle/change
|
;; Emacs feels snappier without checks on newline
|
||||||
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
|
||||||
|
|
||||||
(set! :popup 'flycheck-error-list-mode :select t :autokill t)
|
|
||||||
|
|
||||||
(after! evil
|
(after! evil
|
||||||
;; Flycheck buffer on ESC in normal mode.
|
|
||||||
(defun +syntax-checkers|flycheck-buffer ()
|
(defun +syntax-checkers|flycheck-buffer ()
|
||||||
|
"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 '+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
|
(def-package! flycheck-pos-tip
|
||||||
:unless IS-MAC
|
:commands (flycheck-pos-tip-mode)
|
||||||
:after flycheck
|
|
||||||
:config
|
:config
|
||||||
(setq flycheck-pos-tip-timeout 10
|
(setq flycheck-pos-tip-timeout 10
|
||||||
flycheck-display-errors-delay 0.5)
|
;; fallback to flycheck-popup-tip in terminal Emacs
|
||||||
(flycheck-pos-tip-mode +1))
|
flycheck-pos-tip-display-errors-tty-function
|
||||||
|
#'flycheck-popup-tip-show-popup
|
||||||
|
flycheck-display-errors-delay 0.5))
|
||||||
|
|
||||||
(def-package! flycheck-popup-tip
|
(def-package! flycheck-popup-tip
|
||||||
:when IS-MAC
|
:commands (flycheck-popup-tip-mode flycheck-popup-tip-show-popup))
|
||||||
:after flycheck
|
|
||||||
:hook (flycheck-mode . flycheck-popup-tip-mode))
|
|
||||||
|
|
||||||
|
(after! flycheck
|
||||||
|
(if IS-MAC
|
||||||
|
(flycheck-popup-tip)
|
||||||
|
(flycheck-pos-tip-mode)))
|
||||||
|
|
|
@ -2,6 +2,5 @@
|
||||||
;;; feature/syntax-checker/packages.el
|
;;; feature/syntax-checker/packages.el
|
||||||
|
|
||||||
(package! flycheck)
|
(package! flycheck)
|
||||||
(if IS-MAC
|
(package! flycheck-pos-tip)
|
||||||
(package! flycheck-popup-tip)
|
(package! flycheck-popup-tip)
|
||||||
(package! flycheck-pos-tip))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue