I'd like for the flycheck buffer to be automatically displayed when there are (flycheck detected) errors in the buffer I'm currently editing. My assumption is that this would best be done by checking that (flycheck-current-errors) returns true.
Does anyone know of any existing setting or elisp code that would enable this?
If there isn't anything existing I guess I'll try to write something up, probably following an approach similar to the code in this question Display Flycheck buffer (with errors) when saving but I'll need to figure out a good hook point to run the check just frequently enough to be useful but not add too much background overhead.
based on the suggestion from @gdkrmr above (Thanks!), I coded up the following which does what I want:
(add-hook 'flycheck-after-syntax-check-hook
(lambda ()
(if flycheck-current-errors
(flycheck-list-errors)
(when (get-buffer "*Flycheck errors*")
(switch-to-buffer "*Flycheck errors*")
(kill-buffer (current-buffer))
(delete-window)))))