Emacs merlin-mode and "highlighting" of code w/ errors

A large part of the code in the buffer becomes pinkish w/ a bold font; which makes
me completely unable to read the code which I am currently writing;
to the point that I have to temporarily disable merlin-mode…

merlin_highlighting_errors

Not exactly what you asked, but the latest Emacs 29 comes built-in with the Eglot LSP client. I had resisted switching to LSP from merlin-mode for a long time, but I decided to give it a try and I have been pleasently surprised with it. It uses a somewhat different UI for highlighting errors so perhaps it may alleviate the issue that you are mentioning.

Cheers,
Nicolas

1 Like

I use flycheck-ocaml instead of direct merlin for this reason.

(setq merlin-error-after-save nil)

(use-package flycheck-ocaml
  :after merlin
  :config
  (flycheck-ocaml-setup))
1 Like

I just adopted your flycheck-ocaml proposal.
I am just not super happy about relying on this emacs’ package manager, but it will do for the time being.

Have you tried Tree-sitter for emacs?

Daniel Bünzli suggests adding (setq merlin-error-on-single-line t) to ~/.emacs.