I think just the lint argument to byte-compile-file should suffice and no change to no-byte-compile needed. Lint will always be run. The only reason I can see to add no-byte-compile is for those files which, for whatever reason, really should never be run through the byte compiler (are there any?).

On Sun, Jan 19, 2025 at 6:31 PM Ship Mints <shipmints@gmail.com> wrote:
> As the title says, if you enable `flymake-mode` in an ELisp file with
> a `no-byte-compile: t` in its file-local variables you don't get any
> diagnostics from the compiler (you do still get diagnostics from
> checkdoc, admittedly).
>
> I think `no-byte-compile` only means that we should load the `.el` file
> and not generate a `.elc` file and it shouldn't mean that we should
> refrain from asking the byte-compiler what is its opinion about the
> quality of this code.

Greetings. It looks like this conversation didn't end up with a solution. This is annoying enough to me that I'd like to rejuvenate the discussion. Anyone who adds the cookie to early-init.el and init.el, for example, misses out on flymake diagnostics.

How about adding an optional lint argument to byte-compile-file that elisp-flymake--batch-compile-for-flymake would specify when calling b-c-f? b-c-f, with lint specified, would ignore no-byte-compile for that call. Looks like a three-line change. I'm sure I'm missing some subtleties? I could submit a patch for this, if people agree.

-Stephane