GNU bug report logs - #77480
31.0.50; Flymake: impossible to show multiline diagnostics in echo area

Previous Next

Package: emacs;

Reported by: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>

Date: Thu, 3 Apr 2025 07:45:02 UTC

Severity: normal

Found in version 31.0.50

Done: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 77480 in the body.
You can then email your comments to 77480 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Thu, 03 Apr 2025 07:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>:
New bug report received and forwarded. Copy sent to joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org. (Thu, 03 Apr 2025 07:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Flymake: impossible to show multiline diagnostics in echo
 area
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Thu, 03 Apr 2025 08:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 77480 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
Cc: 77480 <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50; Flymake: impossible to show multiline
 diagnostics in echo area
Date: Thu, 03 Apr 2025 09:29:02 +0100
Nicolás Ojeda Bär <n.oje.bar <at> gmail.com> writes:

> 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.

Certainly not impossible.  First, Flymake has two ways of showing
diagnostic in the echo area:

1 flymake-mode insinuates itself onto ElDoc
   eldoc-documentation-functions, which you have correctly identified,
   so you get at-point echo area updates as you navigate code.

2. interactive, on-demand Flymake commands such as
   flymake-goto-next-error 

In approach number 1, Flymake is usually sharing a hotly contested
ElDoc-managed resource with many other outlets (since you use Eglot you
know what I'm talking about).  I chose the "one line per backend"
default rule from years of dealing with many user reports about this
topic, as a means of keeping the maximum amount of users content.

In approach number 2, as far as I can see, you do suffer this
limitation, and the line is truncated.  But this behaviour has been
around since the inception of modern flymake as I rewrote it circa 2017.

Changing approach number 2 to honour the
`eldoc-echo-area-use-multiline-p` is very problematic for two reasons
(a): it's odd to use a variable not really connected to the mechanism it
uses to access that space, since it calls `message`directly. (b) it
would break a lot of workflows everywhere.  Perhaps I don't have to tell
you that C++ diagnostics can usually span many hundred lines.

So let's get to approach number 1, which is what I suppose you're using
anyway.  I call attention to the facts:

* that C-h . always popups the *eldoc* buffer in a separate window,
  where you can usually see all diagnostics in full in a separate
  window.  There are even extensions that keep this window around in
  some "child-frame" (search for "eldoc-box")

* that you can customize approach number 1.  See examples in the most
  up-to-date Eglot manual (linked in the Eglot home page).
  
  https://joaotavora.github.io/eglot/#More-Customization-1

  Basically, pay attention to the docstrings of eldoc-display-functions
  and eldoc-documentation-functions, then craft your own function to
  work just the way you want it.

  There are a good number of issues in the Eglot tracker showing how to
  do this and how everyone has a slightly different view on the topic.

So there is, in my view, no need for changes to ElDoc or Flymake in this
regard.

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

By the way, this was 2 years ago, hardly "recently".

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Fri, 04 Apr 2025 06:48:02 GMT) Full text and rfc822 format available.

Message #11 received at 77480 <at> debbugs.gnu.org (full text, mbox):

From: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: 77480 <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50; Flymake: impossible to show multiline
 diagnostics in echo area
Date: Fri, 4 Apr 2025 08:47:02 +0200
On Thu, Apr 3, 2025 at 10:28 AM João Távora <joaotavora <at> gmail.com> wrote:
> First, Flymake has two ways of showing
> diagnostic in the echo area:
>
> 1 flymake-mode insinuates itself onto ElDoc
>    eldoc-documentation-functions, which you have correctly identified,
>    so you get at-point echo area updates as you navigate code.
>
> 2. interactive, on-demand Flymake commands such as
>    flymake-goto-next-error
>
> In approach number 1, Flymake is usually sharing a hotly contested
> ElDoc-managed resource with many other outlets (since you use Eglot you
> know what I'm talking about).  I chose the "one line per backend"
> default rule from years of dealing with many user reports about this
> topic, as a means of keeping the maximum amount of users content.

OK, thanks for the context.

> In approach number 2, as far as I can see, you do suffer this
> limitation, and the line is truncated.  But this behaviour has been
> around since the inception of modern flymake as I rewrote it circa 2017.

Indeed, I had 2. in mind when I wrote my previous email.

> Changing approach number 2 to honour the
> `eldoc-echo-area-use-multiline-p` is very problematic for two reasons
> (a): it's odd to use a variable not really connected to the mechanism it
> uses to access that space, since it calls `message`directly. (b) it
> would break a lot of workflows everywhere.

OK, that's fair.

>   There are a good number of issues in the Eglot tracker showing how to
>   do this and how everyone has a slightly different view on the topic.

Thanks for the pointer, I will take a look. I also tried Flycheck
which by default
does not truncate the diagnostics shown in the echo area.

> So there is, in my view, no need for changes to ElDoc or Flymake in this
> regard.

OK, that's fair.

> > Looking at the Git history, this behaviour seems to have changed or
> > introduced recently, in commit 560950468588117b264a9f916fb578e0eb2a124a.
>
> By the way, this was 2 years ago, hardly "recently".

True!

> João

Cheers,
Nicolas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Sat, 19 Apr 2025 13:49:02 GMT) Full text and rfc822 format available.

Message #14 received at 77480 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
Cc: joaotavora <at> gmail.com, 77480 <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50;
 Flymake: impossible to show multiline diagnostics in echo area
Date: Sat, 19 Apr 2025 16:48:06 +0300
Ping!  Any progress with this issue?

> Cc: 77480 <at> debbugs.gnu.org
> From: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
> Date: Fri, 4 Apr 2025 08:47:02 +0200
> 
> On Thu, Apr 3, 2025 at 10:28 AM João Távora <joaotavora <at> gmail.com> wrote:
> > First, Flymake has two ways of showing
> > diagnostic in the echo area:
> >
> > 1 flymake-mode insinuates itself onto ElDoc
> >    eldoc-documentation-functions, which you have correctly identified,
> >    so you get at-point echo area updates as you navigate code.
> >
> > 2. interactive, on-demand Flymake commands such as
> >    flymake-goto-next-error
> >
> > In approach number 1, Flymake is usually sharing a hotly contested
> > ElDoc-managed resource with many other outlets (since you use Eglot you
> > know what I'm talking about).  I chose the "one line per backend"
> > default rule from years of dealing with many user reports about this
> > topic, as a means of keeping the maximum amount of users content.
> 
> OK, thanks for the context.
> 
> > In approach number 2, as far as I can see, you do suffer this
> > limitation, and the line is truncated.  But this behaviour has been
> > around since the inception of modern flymake as I rewrote it circa 2017.
> 
> Indeed, I had 2. in mind when I wrote my previous email.
> 
> > Changing approach number 2 to honour the
> > `eldoc-echo-area-use-multiline-p` is very problematic for two reasons
> > (a): it's odd to use a variable not really connected to the mechanism it
> > uses to access that space, since it calls `message`directly. (b) it
> > would break a lot of workflows everywhere.
> 
> OK, that's fair.
> 
> >   There are a good number of issues in the Eglot tracker showing how to
> >   do this and how everyone has a slightly different view on the topic.
> 
> Thanks for the pointer, I will take a look. I also tried Flycheck
> which by default
> does not truncate the diagnostics shown in the echo area.
> 
> > So there is, in my view, no need for changes to ElDoc or Flymake in this
> > regard.
> 
> OK, that's fair.
> 
> > > Looking at the Git history, this behaviour seems to have changed or
> > > introduced recently, in commit 560950468588117b264a9f916fb578e0eb2a124a.
> >
> > By the way, this was 2 years ago, hardly "recently".
> 
> True!
> 
> > João
> 
> Cheers,
> Nicolas
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Sat, 19 Apr 2025 16:05:05 GMT) Full text and rfc822 format available.

Message #17 received at 77480 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>,
 77480 <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50; Flymake: impossible to show multiline
 diagnostics in echo area
Date: Sat, 19 Apr 2025 17:03:53 +0100
[Message part 1 (text/plain, inline)]
If it wasn't clear from my previous emails in this thread, the "impossible"
in the subject is manifestly overstated.

Nevertheless I'm working on some Flymake changes such should make this much
easier. I'm doing this in the context of the other bug opened by Nicolás
around the same time, the number of which I don't have handy at the moment.

João

On Sat, Apr 19, 2025, 14:48 Eli Zaretskii <eliz <at> gnu.org> wrote:

> Ping!  Any progress with this issue?
>
> > Cc: 77480 <at> debbugs.gnu.org
> > From: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
> > Date: Fri, 4 Apr 2025 08:47:02 +0200
> >
> > On Thu, Apr 3, 2025 at 10:28 AM João Távora <joaotavora <at> gmail.com>
> wrote:
> > > First, Flymake has two ways of showing
> > > diagnostic in the echo area:
> > >
> > > 1 flymake-mode insinuates itself onto ElDoc
> > >    eldoc-documentation-functions, which you have correctly identified,
> > >    so you get at-point echo area updates as you navigate code.
> > >
> > > 2. interactive, on-demand Flymake commands such as
> > >    flymake-goto-next-error
> > >
> > > In approach number 1, Flymake is usually sharing a hotly contested
> > > ElDoc-managed resource with many other outlets (since you use Eglot you
> > > know what I'm talking about).  I chose the "one line per backend"
> > > default rule from years of dealing with many user reports about this
> > > topic, as a means of keeping the maximum amount of users content.
> >
> > OK, thanks for the context.
> >
> > > In approach number 2, as far as I can see, you do suffer this
> > > limitation, and the line is truncated.  But this behaviour has been
> > > around since the inception of modern flymake as I rewrote it circa
> 2017.
> >
> > Indeed, I had 2. in mind when I wrote my previous email.
> >
> > > Changing approach number 2 to honour the
> > > `eldoc-echo-area-use-multiline-p` is very problematic for two reasons
> > > (a): it's odd to use a variable not really connected to the mechanism
> it
> > > uses to access that space, since it calls `message`directly. (b) it
> > > would break a lot of workflows everywhere.
> >
> > OK, that's fair.
> >
> > >   There are a good number of issues in the Eglot tracker showing how to
> > >   do this and how everyone has a slightly different view on the topic.
> >
> > Thanks for the pointer, I will take a look. I also tried Flycheck
> > which by default
> > does not truncate the diagnostics shown in the echo area.
> >
> > > So there is, in my view, no need for changes to ElDoc or Flymake in
> this
> > > regard.
> >
> > OK, that's fair.
> >
> > > > Looking at the Git history, this behaviour seems to have changed or
> > > > introduced recently, in commit
> 560950468588117b264a9f916fb578e0eb2a124a.
> > >
> > > By the way, this was 2 years ago, hardly "recently".
> >
> > True!
> >
> > > João
> >
> > Cheers,
> > Nicolas
> >
> >
> >
> >
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Sat, 19 Apr 2025 16:32:02 GMT) Full text and rfc822 format available.

Message #20 received at 77480 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: n.oje.bar <at> gmail.com, 77480 <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50; Flymake: impossible to show multiline
 diagnostics in echo area
Date: Sat, 19 Apr 2025 19:30:41 +0300
> From: João Távora <joaotavora <at> gmail.com>
> Date: Sat, 19 Apr 2025 17:03:53 +0100
> Cc: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>, 
> 	77480 <at> debbugs.gnu.org
> 
> If it wasn't clear from my previous emails in this thread, the "impossible" in the subject is manifestly
> overstated.
> 
> Nevertheless I'm working on some Flymake changes such should make this much easier. I'm doing this in the
> context of the other bug opened by Nicolás around the same time, the number of which I don't have handy
> at the moment.

Thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Mon, 21 Apr 2025 08:03:02 GMT) Full text and rfc822 format available.

Message #23 received at 77480 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: n.oje.bar <at> gmail.com, 77480 <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50; Flymake: impossible to show multiline
 diagnostics in echo area
Date: Mon, 21 Apr 2025 09:02:56 +0100
I've pushed these changes to master.  They should also be available shortly
in Flymake 1.4.0 from GNU ELPA.

Please test and then this bug can be closed.

João

On Sat, Apr 19, 2025 at 5:30 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: João Távora <joaotavora <at> gmail.com>
> > Date: Sat, 19 Apr 2025 17:03:53 +0100
> > Cc: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>,
> >       77480 <at> debbugs.gnu.org
> >
> > If it wasn't clear from my previous emails in this thread, the "impossible" in the subject is manifestly
> > overstated.
> >
> > Nevertheless I'm working on some Flymake changes such should make this much easier. I'm doing this in the
> > context of the other bug opened by Nicolás around the same time, the number of which I don't have handy
> > at the moment.
>
> Thanks!



-- 
João Távora




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77480; Package emacs. (Thu, 24 Apr 2025 08:01:02 GMT) Full text and rfc822 format available.

Message #26 received at 77480 <at> debbugs.gnu.org (full text, mbox):

From: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77480 <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50; Flymake: impossible to show multiline
 diagnostics in echo area
Date: Thu, 24 Apr 2025 10:00:24 +0200
Hello,

On Mon, Apr 21, 2025 at 10:02 AM João Távora <joaotavora <at> gmail.com> wrote:
>
> I've pushed these changes to master.  They should also be available shortly
> in Flymake 1.4.0 from GNU ELPA.
>
> Please test and then this bug can be closed.

Tested. I confirm it fixes the bug. Thanks!

Cheers,
Nicolas

> João




Reply sent to Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>:
You have taken responsibility. (Thu, 24 Apr 2025 08:10:02 GMT) Full text and rfc822 format available.

Notification sent to Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>:
bug acknowledged by developer. (Thu, 24 Apr 2025 08:10:02 GMT) Full text and rfc822 format available.

Message #31 received at 77480-done <at> debbugs.gnu.org (full text, mbox):

From: Nicolás Ojeda Bär <n.oje.bar <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77480-done <at> debbugs.gnu.org
Subject: Re: bug#77480: 31.0.50; Flymake: impossible to show multiline
 diagnostics in echo area
Date: Thu, 24 Apr 2025 10:09:10 +0200
Closing bug.

Nicolas

On Thu, Apr 24, 2025 at 10:00 AM Nicolás Ojeda Bär <n.oje.bar <at> gmail.com> wrote:
>
> Hello,
>
> On Mon, Apr 21, 2025 at 10:02 AM João Távora <joaotavora <at> gmail.com> wrote:
> >
> > I've pushed these changes to master.  They should also be available shortly
> > in Flymake 1.4.0 from GNU ELPA.
> >
> > Please test and then this bug can be closed.
>
> Tested. I confirm it fixes the bug. Thanks!
>
> Cheers,
> Nicolas
>
> > João




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 May 2025 11:24:19 GMT) Full text and rfc822 format available.

This bug report was last modified 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.