Subject: Re: bug#24623: 25.1; Flymake turns off if check command fails without reporting errors in the file being edited

From: [email-masked] (João Távora)
Date: Fri, 03 Nov 2017 11:51:23 +0000

Dave Abrahams <[email-masked]> writes:

> In these lines from flymake-post-syntax-check:
>
>       (if (and (equal 0 err-count) (equal 0 warn-count))
>           (if (equal 0 exit-status)
>               (flymake-report-status "" "") ; PASSED
>             (if (not flymake-check-was-interrupted)
>                 (flymake-report-fatal-status "CFGERR"
>                                              (format "Configuration error has occurred while running %s" command))
>               (flymake-report-status nil ""))) ; "STOPPED"
>         (flymake-report-status (format "%d/%d" err-count warn-count) "")))))
>
> err-count and warn-count are the count of errors detected *in the file
> being edited*.  My syntax check command must consider a whole batch of
> files at once, and sometimes those other files have errors in them.
> That should not disable syntax checking in the current file, but flymake
> has this behavior unconditionally, and there's no way to turn it off.

[Eli, I’m CC’ing you since I think this bug can be marked "wontfix" or
equivalent]

Hello Dave and sorry for the extremely late reply to this bug.

This is easy to reproduce with GCC as a checker tool when checking a .h
file with no errors but included by a .c file with some errors.

I just wanted to note, if you haven’t noticed already, that Flymake has
been redesigned in the upcoming Emacs 26 and the functionality you refer
to is now considered obsolete.

Nevertheless, it is still supported and lives in a so called "legacy
backend". Your particular problem also popped up for me testing. My
solution would be to invoke your syntax checker tool in a way that the
invocation univocally returns 0, like having this in a Makefile:

syntax-check:
	mytool $(CHK_SOURCES) || true

But there are new much better ways to configure Flymake with your syntax
checker. They are described in the Flymake Info manual, which also
broadly describes the redesign effort). You can read this manual with
M-x info in the upcoming Emacs version (or one of the already available
pretests thereof).

Given the workaround, I don’t there’s much reason to fix this.

João