flycheck / flycheck

On the fly syntax checking for GNU Emacs
https://www.flycheck.org
GNU General Public License v3.0
2.4k stars 448 forks source link

Question regarding flycheck-define-generic-checker callback function #538

Closed Sarcasm closed 9 years ago

Sarcasm commented 9 years ago

Hello,

First thank you, this package, it looks great!

I'm working on implementing a checker for irony-mode.

In irony-mode I will have the syntax errors are available either immediately or asynchronously.

I'm wondering if it is safe for the start function of flycheck-define-generic-checker to call the status-callback immediately?

In my code I will probably have something along the lines of:

(if (diagnostics-already-available-p)
  (funcall callback 'finished diagnostics)
 (async-diagnostics callback))
swsnr commented 9 years ago

It is, as of #533.

Sarcasm commented 9 years ago

Thank you, pardon my lack of search, I actually stumbled upon this issue a few days ago.

IMHO looking at the flycheck-define-generic-checker it is not totally obvious.

swsnr commented 9 years ago

@Sarcasm Looking at the implementation or the docstring?

Sarcasm commented 9 years ago

A quick look at the implementation gave me the idea that it would be safe.

Looking at http://www.flycheck.org/en/latest/dev/api.html#el.function.flycheck-define-generic-checker I couldn't find something that would confirm this.

Since I prefer not to rely on implementation details I preferred to ask for confirmation. :)

swsnr commented 9 years ago

@Sarcasm I see. I added a little paragraph to the docstring to clarify this. Please tell me what you think.

Sarcasm commented 9 years ago

LGTM! :+1: