Skip to content

Conversation

@bcc32
Copy link

@bcc32 bcc32 commented Mar 12, 2025

This way, the package works as expected even when the user enables it
by customizing flycheck-display-errors-function (or happens to save
such a customization permanently after enabling
flycheck-pos-tip-mode).

Fix #36.

The new implementation strategy is to add
flycheck-pos-tip-hide-messages to the appropriate hooks temporarily
when the display function is called, and remove it when the messages
are actually dismissed. This avoids depending on the minor mode being
enabled at all.

Now, the only job of the minor mode is to be able to interactively
toggle the value of flycheck-display-errors-function.

This way, the package works as expected even when the user enables it
by customizing flycheck-display-errors-function.
Comment on lines +106 to +107
(dolist (hook flycheck-pos-tip--hide-hooks)
(remove-hook hook #'flycheck-pos-tip-hide-messages))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be out of the unless block?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that doesn't quite work. flycheck-pos-tip-hide-messages is called in post-command-hook so invoking any command that doesn't happen to move point would cause the hook to be removed if it was outside of the unless block.

Consider the following example operations:

  1. Move point onto a highlighted error. Wait a bit, then the tooltip will be displayed.
  2. Press C-h . (or even just C-g, etc.) which is a command that does not change current-buffer, buffer-modified-tick, or point
  3. Move point off of the error. This should hide the tooltip

With the suggested snippet moved outside of the unless block, (3) does not hide the error as it should.

(Sorry for the delay, I had a lot of personal stuff going on recently.)

@cpitclaudel
Copy link
Member

Woops, I missed this PR. It looks good to me, I left one comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buggy interaction with flycheck-display-errors-function customization

2 participants