diff --git a/modules/feature/syntax-checker/config.el b/modules/feature/syntax-checker/config.el index 4267f0a60..816d81589 100644 --- a/modules/feature/syntax-checker/config.el +++ b/modules/feature/syntax-checker/config.el @@ -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))) diff --git a/modules/feature/syntax-checker/packages.el b/modules/feature/syntax-checker/packages.el index ae0d38629..46532dabd 100644 --- a/modules/feature/syntax-checker/packages.el +++ b/modules/feature/syntax-checker/packages.el @@ -2,6 +2,5 @@ ;;; feature/syntax-checker/packages.el (package! flycheck) -(if IS-MAC - (package! flycheck-popup-tip) - (package! flycheck-pos-tip)) +(package! flycheck-pos-tip) +(package! flycheck-popup-tip)