flycheck / flycheck-pos-tip

Flycheck errors display in tooltip
GNU General Public License v3.0
122 stars 10 forks source link

flycheck-pos-tip prevents the use of any other tooltips #13

Open jschaf opened 8 years ago

jschaf commented 8 years ago

You can't use tooltips for anything else if flycheck-pos-tip is enabled.

flycheck-pos-tip-hide-messages is in post-command-hook, so a call to pos-tip-show or any other command will hide the tooltip immediately after display.

Steps to reproduce.

  1. Enable flycheck-pos-tip
  2. Run eval-expression M-: (pos-tip-show "FLASH")
  3. You might see a tooltip flash, but more likely you won't see anything.

Possible fixes

  1. Remove the hooks after completing your display and add them when showing an error message.
  2. Use a buffer-local sentinel variable that tracks if you're currently displaying an error message. Only hide tooltips if the sentinel is true.
jschaf commented 8 years ago

After taking another look, I think this was caused by a bad function in my personal post-command-hook. I can't reproduce, so I'll close it.

hchapman commented 7 years ago

I'm actually getting this in a spacemacs install: https://github.com/syl20bnr/spacemacs/issues/8551

I admit I don't know if it works for a clean emacs install or not though.

cpitclaudel commented 7 years ago

Please try reproducing it in a clean Emacs, and let us know :)

hchapman commented 7 years ago

Ok, it's still happening for me.

Using i3 manager on Ubuntu Yakkety.

On Emacs, build: GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.20.9) of 2017-03-16

edit I installed emacs-snapshot from the ubuntu elisp ppa: https://launchpad.net/~ubuntu-elisp/+archive/ubuntu/ppa

.emacs.d/init.el

;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (flycheck-pos-tip))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

Using package-list-packages, I installed flycheck-pos-tip.

In scratch, (tooltip-show "hello"), C-x C-e shows a tooltip for ~5s as expected.

M-x flycheck-pos-tip-mode

C-x C-e to execute the same tooltip-show call shows nothing; some C-x C-e gives an occasional flicker of a tooltip

cpitclaudel commented 7 years ago

Thanks. I'll have a look, but I think this is partly an emacs limitation (you can't have two tooltips in any case). This is being worked on for Emacs 26, btw.

seagle0128 commented 7 years ago

The root cause is flycheck-pos-tip-hide-messages hides all tooltips. Try this workaround:

    ;; Don't hide pos tip to advoid suspress other pos tips.
    (defun flycheck-pos-tip-hide-messages ()
      "Hide messages currently being shown if any."
      (flycheck-hide-error-buffer)))

Please note that flycheck-hide-error-buffer is unable to be executed in terminal mode.