GNU bug report logs - #48452
28.0.50; flymake for elisp does not respect `load-path`

Previous Next

Package: emacs;

Reported by: Max Brieiev <max.brieiev <at> gmail.com>

Date: Sat, 15 May 2021 20:47:02 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: João Távora <joaotavora <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Max Brieiev <max.brieiev <at> gmail.com>, 48452 <at> debbugs.gnu.org
Subject: bug#48452: 28.0.50; flymake for elisp does not respect `load-path`
Date: Thu, 14 Jul 2022 21:29:32 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Max Brieiev <max.brieiev <at> gmail.com> writes:
>
>> 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)`
>
> OK; so a way to reproduce this is to say (with "emacs -Q"):
>
> M-: (push (expand-file-name "~/.emacs.d/elpa/compat-28.1.1.1/") load-path)
> M-x flymake-mode
>
> and then notice that there's a warning on
>
> (require 'subr-x)
> (require 'compat)
>
> even though it can be required fine.
>
> I've added João to the CCs; perhaps he has some comments.

I think elisp-flymake-byte-compile-load-path is relevant here.

   elisp-flymake-byte-compile-load-path is a variable defined in `elisp-mode.el'.
    
   Its value is ("./")
    
   Like `load-path' but used by `elisp-flymake-byte-compile'.
   The default value contains just "./" which includes the default
   directory of the buffer being compiled, and nothing else.
    
     This variable is safe as a file local variable if its value
     satisfies the predicate which is a byte-compiled expression.

I don't usually develop packages in ~/.emacs.d/elpa, in fact developing
packages there is kind of questionable IMHO, as they are normally not
git checkouts.  This is, AFAIK, straight.el's main raison d'etre,
although I don't use that either.

But it could make sense to add ~/.emacs.d/elpa/* to the variable, if the
package you're developing somewhere else has a dependency on other Elpa
packages.

Although it's a safety hazard I guess (don't forget that the
elisp-flymake-byte-compile backend runs compile-time code!).  Or maybe
add a `package-initialize` call in the Emacs -Q that
elisp-flymake-byte-compile runs.  But that'll probably slow checking
down a bit, so i'd like to see some timings for the slowdown
before&after.

Or maybe, Max, you can just set this variable it in your file-local
variables or the dir-locals.el of the package you're developing.

João









This bug report was last modified 2 years and 298 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.