bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23638: "load" should use directory from load-file-name as a final fa


From: Lars Ingebrigtsen
Subject: bug#23638: "load" should use directory from load-file-name as a final fallback
Date: Sun, 07 Feb 2021 14:14:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Robert Weiner <rswgnu@gmail.com> writes:

> The "load" function could do more of the right thing in the case where
> an absolute path is given in a load call and then within the file
> loaded, require or load references are made to relative files whose
> directories are not in load path but the files do exist within the
> directory specified by the original load.

It's an interesting idea, and I guess it's pretty trivial to implement?
That is, if `load' is called with an absolute path, then bind
`load-path' and add the directory to the value locally.

It sounds convenient, but also kinda chaotic -- if I load "/tmp/foo.el",
then I may not want to load anything else from "/tmp/" just because
"/tmp/foo.el" says "(require 'bar)".  That is, it sounds kinda insecure.

There's also the issue of being consistent -- today,
'(load "/tmp/foo.el")' and `C-x C-f /tmp/foo.el RET' and then
`eval-buffer' gives the same result...  but this wouldn't be the case if
we changed `load' this way.

Now, we could add a new command `load-file-with-directory' or something
that would do this -- that would be more clear, at least, that we're
playing games with `load-path', and would be almost as convenient as if
`load' did this itself.

Any opinions here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]