feature/syntax-checker: redesign tooltip support

Use flycheck-posframe in GUI Emacs (26+) and flycheck-popup-tip
everywhere else.
This commit is contained in:
Henrik Lissner 2018-05-07 18:50:44 +02:00
parent da598551a3
commit afb92a8c7f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 51 additions and 22 deletions

View file

@ -10,6 +10,9 @@
;; Emacs feels snappier without checks on newline
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
;; Popup
(add-hook 'flycheck-mode-hook #'+syntax-checker-popup-mode)
(after! evil
(defun +syntax-checkers|flycheck-buffer ()
"Flycheck buffer on ESC in normal mode."
@ -25,26 +28,10 @@
(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
: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.7)
(flycheck-pos-tip-mode))
(def-package! flycheck-popup-tip
:commands (flycheck-popup-tip-mode flycheck-popup-tip-show-popup)
:after flycheck
:config (if IS-MAC (flycheck-popup-tip-mode)))
:commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup))
(def-package! flycheck-posframe
:when EMACS26+
:commands flycheck-posframe-show-posframe)