Skip to content

Commit

Permalink
Hide tooltip when Emacs looses focus
Browse files Browse the repository at this point in the history
Needs Emacs 24.4 to work.

See GH-6
  • Loading branch information
Sebastian Wiesner committed Nov 11, 2015
1 parent f2459b4 commit 7f05200
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions flycheck-pos-tip.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,19 @@ Uses `pos-tip-show' under the hood."
"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)))
(let ((hooks '(post-command-hook focus-out-hook)))
(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)
(dolist (hook hooks)
(add-hook hook #'flycheck-pos-tip-hide)))
(setq flycheck-display-errors-function
flycheck-pos-tip-old-display-function)
(dolist (hook hooks)
(remove-hook hook 'flycheck-pos-tip-hide)))))

(provide 'flycheck-pos-tip)

Expand Down

0 comments on commit 7f05200

Please sign in to comment.