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

From: Max Brieiev <[email-masked]>
Date: Sat, 15 May 2021 23:46:28 +0300

As far as I understand Emacs doesn't add "~/.emacs.d/elpa" to
`load-path`, when started with -Q flag, but this bug report needs a
fully established `load-path`. So to reproduce the bug please create an
empty ".emacs" file and start Emacs.

Then:

- C-x C-f ~/.emacs
- M-x flymake-mode
- in .emacs buffer type require expression, requiring any library on
  your elpa path, e.g. `(require 'dash)`.

Observe that flymake reports "Cannot open load file: No such file or
directory, dash", even though `load-path` contains
"~/.emacs.d/elpa/dash-<version>/" directory. Screenshot below
illustrates this:

In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4)
 of 2021-05-09 built on arch-max
Repository revision: 5eb27833c498584797822838f00b87e52bad1c22
Repository branch: makepkg
Windowing system distributor 'System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-modules --without-gconf --without-gsettings
 --with-native-compilation --with-pgtk --with-x-toolkit=gtk3
 --without-xaw3d --without-m17n-flt --with-cairo --with-xwidgets
 --without-compress-install 'CFLAGS=-march=x86-64 -mtune=generic -O2
 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS -Wformat
 -Werror=format-security -fstack-clash-protection -fcf-protection -g
 -fuse-ld=gold -g -fuse-ld=gold'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PGTK PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM
XWIDGETS GTK3 ZLIB

Important settings:
  value of $LC_MESSAGES: 
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  yas-global-mode: t
  show-paren-mode: t
  global-company-mode: t
  display-battery-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/max/.emacs.d/elpa/transient-20210426.2141/transient hides /usr/share/emacs/28.0.50/lisp/transient

Features:
(shadow comp comp-cstr rx sort vc-mtn vc-hg vc-git diff-mode easy-mmode
vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher mail-extr
emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa
derived epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail cl-extra company-oddmuse
company-keywords company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-bbdb format-spec
solarized-light-high-contrast-theme solarized-palettes solarized
solarized-faces color yasnippet quail paren gnus nnheader gnus-util
rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums time-date mail-utils
mm-util mail-prsvr wid-edit company edmacro kmacro battery dbus xml
cus-load eglot array filenotify jsonrpc ert pp ewoc debug backtrace
help-mode find-func xref flymake-proc flymake thingatpt warnings compile
text-property-search comint ansi-color ring pcase project imenu info
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/pgtk-win
pgtk-win term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads xwidget-internal dbusbind
inotify dynamic-setting font-render-setting cairo move-toolbar gtk
x-toolkit pgtk lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 251103 8902)
 (symbols 48 19072 1)
 (strings 32 54692 4270)
 (string-bytes 1 1713885)
 (vectors 16 37517)
 (vector-slots 8 1351452 110243)
 (floats 8 246 233)
 (intervals 56 486 0)
 (buffers 992 14))