Closed Wilfred closed 7 years ago
@Wilfred Thanks for the report, but I'm not sure what the problem is.
Considering that flycheck-pos-tip-mode
is a global minor mode, how can it get activated twice without being deactivated in between? Can you provide a recipe to reproduce the issue in emacs -Q?
Ooh, this was a little subtle to debug.
It can get activated twice, but only if it's not called interactively:
(progn
(setq flycheck-pos-tip-old-display-function #'flycheck-display-error-messages)
(flycheck-pos-tip-mode)
(flycheck-pos-tip-mode)
flycheck-pos-tip-old-display-function) ;; flycheck-pos-tip-error-messages
This issue does not occur if you just do M-x flycheck-pos-tip-mode
. I had flycheck-pos-tip-mode
activated by a hook, which was what triggered this behaviour.
@Wilfred Oh, that's a bad surprise: I thought that a minor mode would implicitly guard against being activated twice, but apparently it doesn't :flushed:
I pushed a fix which activates this mode only if it's not already activated.
Thank you! :)
If you have enabled
flycheck-pos-tip-mode
in multiple buffers,flycheck-pos-tip-old-display-function
is overwritten.The first time
flycheck-pos-tip-mode
is called, it setsflycheck-pos-tip-old-display-function
correctly. However, on the second time it's activated, it setsflycheck-pos-tip-old-display-function
toflycheck-pos-tip-error-messages
.As a result, disabling
flycheck-pos-tip-mode
withM-x flycheck-pos-tip-mode
does not have the intended effect, becauseflycheck-display-errors-function
stays asflycheck-pos-tip-error-messages
.I think a good solution would be to make
flycheck-pos-tip-old-display-function
a buffer-local variable.