Subject: bug#48452: 28.0.50; flymake for elisp does not respect `load-path`

From: Max Brieiev <[email-masked]>
Date: Wed, 13 Jul 2022 19:24:32 +0300

Lars Ingebrigtsen <[email-masked]> writes:

> Do you have a complete step by step recipe that demonstrates the
> problem?  I tried the original instructions, but got no messages from
> flymake (except complaining that the .emacs file doesn't start with ;;;
> Commentary).

I think this issue can not be reproduced with emacs -Q, because in this
case Elpa packages are not added to load-path. With emacs -Q, flymake
will rightfully complain "No such file or directory", when you `(require
'any-elpa-package)`

However, during the normal Emacs session, all Elpa packages are on the
load-path, but flymake complains as if they were not.

For me the following reproduces the issue:
1. Start Emacs
2. Switch to scratch buffer
3. Enable flymake: M-x flymake-mode
4. Type:

    (require 'subr-x)

  Observe that flymake does not complain

5. Now load anything from Elpa:

    (require 'compat)

  Observe that flymake starts complaining, even though compat is on
  load-path and the expression above can be successfully evaluated.

screenshot: