Subject: bug#77480: 31.0.50; Flymake: impossible to show multiline diagnostics in echo area

From: Nicolás Ojeda Bär <[email-masked]>
Date: Thu, 03 Apr 2025 09:43:43 +0200

Dear Flymake maintainers (Cc: João Távora),

While using Eglot and its default Flymake integration, it seems
impossible to make Flymake display multi-line diagnostics in the echo
area: diagnostic messages are systematically truncated and only their
first line is shown.

While this may work well with certain language and diagnostic styles (eg
Lisp), it is wholly inadecuate for other types of languages where
diagnostics are routinely multiline and the first line offers no useful
information (because it is only part of sentence). This is the case of
OCaml, which I am using.

Furthermore, Flymake uses Eldoc to render diagnostics in the echo area,
and there is a variable eldoc-echo-area-use-multiline-p that looks like
it could be used to control this behaviour, but unfortunately Flymake
does not honour it.

Looking at the Git history, this behaviour seems to have changed or
introduced recently, in commit 560950468588117b264a9f916fb578e0eb2a124a.

Some possible approaches for improvement:

- Do not have Flymake truncate the message and instead delegate to Eldoc
  (supposedly, via the eldoc-echo-area-use-multiline-p variable, but I
  have not been able to test this variable so am not 100% sure of what
  its expected semantics are).

- Honour the variable eldoc-echo-area-use-multiline-p in the Flymake
  code (this seems strictly worse than the previous point as it would
  entail some code duplication).

- Add a variable to Flymake to specify whether to truncate or not
  diagnostics shown in the echo area. This could be useful if we want a
  separate mechanism than Eldoc's to control how diagnostics are shown
  in the echo area.

I am happy to prepare a patch if we can agree on a way forward.

Thank you!

Cheers,
Nicolas