Subject: Re: bug#50244: 28.0.50; Support project-wide diagnostics reports in flymake.el

From: Theodor Thornhill <[email-masked]>
Date: Mon, 13 Sep 2021 21:47:15 +0200

João Távora <[email-masked]> writes:

>
> The main changes to flymake.el and its documentation are now ready to
> push.  There are some bugs regarding sorting in the diagnostics listing,
> and the maybe order and length of columns needs rearranging, but these
> can be sorted out later.
>

Very nice, great job!  I've been looking through the code the last
couple of days.  I think it makes sense to treat the list-only diags the
way you do here, in that we only need to be able to jump to it, in
addition to know that the error is there.

One thing I saw while reading and that might not be needed anymore is
contained in the diff at the bottom.  There might be reasons for this,
but I _think_ this should be covered in the &aux variable?

>
> Another important aspect is that I haven't had a change to test this
> with Eglot, which was one of the main motivators behind this change.
> The reason is that I don't have easy access to a server which reports
> diagnostics project wide (I thought clangd did, but I was mistaken).  So
> the only client of the new functionality is the flymake-cc non-LSP
> backend, for now.
>
> Theodor, now would be a good time for you to step in with changes to
> Eglot that use the new `flymake-list-only-diagnostics` experimental API
> in flymake.el.  Likely, some adjustments will have to be made to both
> packages.
>

I will absolutely jump at this as quickly as possible.  I'm not exactly
sure how fast I'll be, since I'm on parental leave right now.  How would
you want to receive the changes to eglot?  As part of this bug, or as a
new issue over at GH? I'm fine with either. Considering both flymake and
eglot may be affected, maybe this bug is a good place?

Again, thanks - now I can soon stop maintaining a trash fork of eglot to
get this functionality :)

All the best, and I'll get back to you soon!

Theo

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 83c0b4dd99..543cfe64f4 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -815,8 +815,6 @@ calling convention described in
 to handle a report even if TOKEN was not expected.  REGION is
 a (BEG . END) pair of buffer positions indicating that this
 report applies to that region."
-  (unless state
-    (error "Can't find state for %s in `flymake--state'" backend))
   (cond
    ((null state)
     (flymake-error