I can't get flycheck to do its thing immediately after opening a file. It will check/find errors if I save the file. And it will check/find errors if I execute the M-x flycheck-mode command twice (i.e. - disabling then re-enabling flycheck mode).

I'm guessing there're some subtle timing issues between add-hook, eval-after-load, and with-eval-after-load that I don't fully understand?

The relevant (I think) lines from my ~/.emacs.d/init.el file:

;; Global Flycheck

(setq flymake-no-changes-timeout nil)
(setq flymake-start-syntax-check-on-newline nil)
(setq flycheck-check-syntax-automatically '(save mode-enabled))

(add-hook 'literate-haskell-mode-hook
          '(lambda () (flycheck-select-checker 'haskell-stack-liquid)))
(add-hook 'literate-haskell-mode-hook 'flycheck-mode)

Pulling the following line out of my (use-package dante ...) S-expression and into the top level of my init.el file did the trick.

(add-hook 'haskell-mode-hook          'flycheck-mode)
  • 1
    It should work in your use-package declaration as well, try it under :init. Jul 4 '19 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.