Skip to content

Commit

Permalink
Turn into a proper minor mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Wiesner committed Nov 11, 2015
1 parent 89a1772 commit 00f6aed
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions flycheck-pos-tip.el
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ Uses `pos-tip-show' under the hood."
(-when-let (messages (-keep #'flycheck-error-format-message-and-id errors))
(funcall flycheck-pos-tip-show-function messages))))

(defvar flycheck-pos-tip-old-display-function nil
"The former value of `flycheck-display-errors-function'.")

;;;###autoload
(define-minor-mode flycheck-pos-tip-mode
"A minor mode to show Flycheck error messages in a popup."
:global t
:group 'flycheck
(if flycheck-pos-tip-mode
(progn
(setq flycheck-pos-tip-old-display-function
flycheck-display-errors-function
flycheck-display-errors-function
#'flycheck-pos-tip-error-messages)
(add-hook 'post-command-hook #'flycheck-pos-tip-hide))
(setq flycheck-display-errors-function
flycheck-pos-tip-old-display-function)
(remove-hook 'post-command-hook 'flycheck-pos-tip-hide)))

(provide 'flycheck-pos-tip)

;;; flycheck-pos-tip.el ends here

0 comments on commit 00f6aed

Please sign in to comment.