Subject: Re: bug#40351: Flymake error count

From: João Távora <[email-masked]>
Date: Tue, 12 May 2020 19:30:14 +0100

Hello, [email-masked]:

I'm sorry for the very long delay in answering this.  Next time you
report a bug for flymake, make sure you also forward me the message that
the bug reporting system sends back to you.  (yes I know you had written
me separately).

Anyway, to your problem:

>                        for (beg . end) = (flymake-diag-region source lnum)
>                        for type = (make-symbol (match-string 3))
                                     ^^^^^^^^^^^

I think the problem you experience is found here.  TYPE cannot be a
different symbol for each error you find, otherwise Flymake will think
that each error has its unique type.  If `(match-string 3)` is indeed
often enough the same string, you can try `intern` instead.

Let's say (match-string 3) can only return "oops", "warn" or "info" I would write
that line like

    for type = (intern (format "flymake-phpcs--%s" (match-string 3)))

Then separately I would write in a top-level-form

    (put 'flymake-phpcs--oops 'flymake-category 'flymake-error)
    (put 'flymake-phpcs--warn 'flymake-category 'flymake-warning)
    (put 'flymake-phpcs--info 'flymake-category 'flymake-note)

Then the errors would be merged with the errors from Eglot, I think.

See the manual section 2.1 Customizing Flymake error types

I see the the docstring for `flymake-make-diagnostic` could see some
improvement.  In particular, the phrase "TYPE is a key to symbol"
doesnt' make much sense.

João