tools/flycheck: simplify popup-tip advice

Relevant to #1209
This commit is contained in:
Henrik Lissner 2019-02-28 05:01:04 -05:00
parent 812c834970
commit b871d400e5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 13 additions and 30 deletions

View file

@ -1,24 +1,13 @@
;;; tools/flycheck/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +flycheck*popup-tip-delete-popup (orig-fn)
"TODO"
(when (display-graphic-p)
(funcall orig-fn)))
;;;###autoload
(defun +flycheck*popup-tip-show-popup (orig-fn errors)
"TODO"
(if (and EMACS26+
(featurep 'flycheck-posframe)
(display-graphic-p))
(flycheck-posframe-show-posframe errors)
(funcall orig-fn errors)))
;;;###autoload
(defun +flycheck|disable-popup-tip-for-lsp ()
"Disable `+flycheck-popup-mode' if `lsp-ui-mode' and `lsp-ui-sideline-enable'
are non-nil."
(when (and (bound-and-true-p lsp-ui-mode)
lsp-ui-sideline-enable)
(flycheck-popup-tip-mode -1)))
(defun +flycheck|init-popups ()
"Activate `flycheck-posframe-mode' if available and in GUI Emacs.
Activate `flycheck-popup-tip-mode' otherwise.
Do nothing if `lsp-ui-mode' is active and `lsp-ui-sideline-enable' is non-nil."
(unless (and (bound-and-true-p lsp-ui-mode)
lsp-ui-sideline-enable)
(if (and (fboundp 'flycheck-posframe-mode)
(display-graphic-p))
(flycheck-posframe-mode +1)
(flycheck-popup-tip-mode +1))))