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

From: Robert Weiner <[email-masked]>
Date: Sat, 28 May 2016 10:33:20 -0400

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.

So for example, we have a testing directory, "/tmp/" not in load-path with
files a.el and b.el.
In a.el, there is the line: (require 'b) and then we do a (load
"/tmp/a.el").  The require of b will fail but since load-file-name is set
to /tmp/a.el, if no matches are found in load-path, it would be a simple
matter to try to resolve b in the directory specified in load-file-name as
a fallback.

This would help in many cases when experimenting with new directories of
code that have not yet been added to the load path.  It also would help the
Emacs package system since it adds only the top-level directory of a
package to load-path when trying to byte-compile the package.  If the
package contains subdirectories, which require or load local files within
these subdirectories, these will fail right now but would succeed with the
above change.

Any comments, suggestions or issues with this?  Please consider
implementing this and help make multi-directory packages a reality.