From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: Max Brieiev <max.brieiev@gmail.com>,
Lars Ingebrigtsen <larsi@gnus.org>,
48452@debbugs.gnu.org
Subject: bug#48452: 28.0.50; flymake for elisp does not respect `load-path`
Date: Sat, 23 Jul 2022 10:26:45 -0400 [thread overview]
Message-ID: <jwv8roj7w9s.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87y1wkmba4.fsf@gmail.com> ("João Távora"'s message of "Sat, 23 Jul 2022 10:24:51 +0100")
> At some point in the past, Stefan was working on a "sandboxed" Emacs
> that could, in theory, pave the way for automatically enabled Elisp
> Flymake, but I haven't heard of that effort lately.
I need to get back to that indeed :-)
>> It seems to me that there's two useful values for load-path in the
>> Flymake backend: Either just the standard load-path (so that you
>> actually get the same results as when doing a batch byte-compile) or the
>> current running load-path (so that you get the same results as when you
>> `require' the file from your .emacs, say). Altering the load-path to
>> also include the ELPA directories doesn't really help much, because
>> people have all kinds of code that's not in ELPA (but is in their
>> load-path).
AFAIC, it's not just `load-path`: the set of autoloaded functions (and
a few other similar things) is also relevant.
> I think we have to ask ourselves: what is Flymake used for? The most
> useful answers will come from the people who actually use it, though
> potential uses are also interesting.
I don't think we can hope to make flymake-elisp work correctly in all
existing cases, because there are conflicting requirements there.
So, we should take it for granted that some use-cases will be considered
as "unsupported", and the important thing is to figure out what behavior
to provide such that all(?) use-cases can be adapted (and such that the
behavior is sane enough to be described, understandable, and
predictable).
> Having './' in the default load-path for elisp-flymake-byte-compile is
> fundamental for the accuracy of this prediction. Why? Because the
> clients of my packages -- regardless if they use package.el,
> straight.el, etc or just simply using a git checkout -- will always have
> the the files I have in some directory in some other directory in their
> machines, and _that_ directory will be in the load-path.
BTW, while the GNUmakefile of `elpa-admin` also adds `.` to the
`load-path`, there are cases where this is harmful.
E.g. the "pcase benchmark" in `elisp-benchmarks` used to be in the file
.../benchmarks/pcase.el and it (of course) required Emacs to load
`pcase.el` (the other one).
This required the hideous workaround:
(eval-and-compile
;; ¡FIXME! The GNUmakefile of elpa.git uses:
;;
;; ... -L $(dir $@) -f batch-byte-compile $<
;;
;; to compile each file. This is handy for some cases such as files in
;; `contrib' subdirectories but for this `pcase.el' file it causes this
;; `pcase.el' to hide the *real* `pcase.el'. So we workaround this problem
;; here by removing the offending element from `load-path'. Yuck!
;;
;; We should probably change GNUmakefile instead so it doesn't forcefully
;; add the directory to `load-path', e.g. make this dependent on the
;; presence of special file like `.dont-add-to-load-path'.
(when load-file-name
(setq load-path (remove (file-name-directory load-file-name) load-path))))
We have several files in `lisp` whose directory is not in `load-path`
(most of them under `lisp/cedet`).
But, note that I decided to use the above hack (later replaced by
the simpler solution of renaming the file to `elb-pcase.el`) in
preference to changing the GNUmakefile not to add `.` to `load-path`.
Stefan
next prev parent reply other threads:[~2022-07-23 14:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 20:46 bug#48452: 28.0.50; flymake for elisp does not respect `load-path` Max Brieiev
2022-07-13 11:47 ` Lars Ingebrigtsen
2022-07-13 13:47 ` Max Brieiev
2022-07-13 13:57 ` Lars Ingebrigtsen
2022-07-13 16:24 ` Max Brieiev
2022-07-14 17:15 ` Lars Ingebrigtsen
2022-07-14 20:29 ` João Távora
2022-07-15 9:46 ` Lars Ingebrigtsen
2022-07-15 10:03 ` João Távora
2022-07-16 10:12 ` Lars Ingebrigtsen
2022-07-18 19:17 ` João Távora
2022-07-22 19:52 ` Lars Ingebrigtsen
2022-07-22 21:09 ` João Távora
2022-07-22 21:12 ` Lars Ingebrigtsen
2022-07-22 21:46 ` João Távora
2022-07-23 5:50 ` Lars Ingebrigtsen
2022-07-23 9:24 ` João Távora
2022-07-23 14:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-07-23 17:45 ` João Távora
2022-07-23 17:55 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-24 9:18 ` Lars Ingebrigtsen
2022-07-24 9:57 ` João Távora
2022-07-23 15:05 ` Max Brieiev
2022-07-23 17:16 ` João Távora
2022-07-15 11:53 ` Max Brieiev
2022-07-14 9:22 ` Max Brieiev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv8roj7w9s.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=48452@debbugs.gnu.org \
--cc=joaotavora@gmail.com \
--cc=larsi@gnus.org \
--cc=max.brieiev@gmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).