user-lisp-directory: can sibling files `require` each other? (byte-compile error)

Antonio Romano <[email protected]> Wed, 24 Jun 2026 10:27:39 +0000
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Hello,

I'm trying out the new `user-lisp-directory` and I'm running into a
byte-compile error when one file in the directory requires another file
that lives right next to it.

Minimal example:

[...]/user-lisp/test/test.el:

    (defun test/test ()
      (message "test"))
    (provide 'test)

[...]/user-lisp/test/test-2.el:

    (require 'test)
    (defun test-2/test ()
      (message "test2"))
    (provide 'test-2)

On a fresh Emacs startup (so the automatic compilation pass runs), I get:

    Error (bytecomp): Cannot open load file: No such file or directory, test

So it seems that during byte compilation the load-path does not point to
the user-lisp-directory. My question is: is this intended? How can i
overcome this?

My Emacs version: GNU Emacs 31.0.90 (build 1, x86_64-pc-linux-gnu, GTK+
Version 3.24.52, cairo version 1.18.4) of 2026-06-08

Thanks in advance.