Hi. I'm working on a custom module loader, roughly equivalent to
use-modules but taking a file path instead of a module name. I ran
into a problem with this bit:
(save-module-excursion
(lambda ()
(set-current-module my-module)
(set! %load-hook my-hook)
(primitive-load my-module-path)))
My %load-hook sees the correct current module. But in the call to
primitive-load, the code in the loaded file sees a new, empty current
module. Then it runs into problems since that module hasn't been
prepared by my hook.
The odd thing is this problem seems to be triggered only when
my-module's name is set to a list of just one symbol, whose name is
any absolute path referring to the file being loaded (not necessarily
my-module-path exactly). If it's a relative path, or not a path for
this file, or a list of multiple symbols regardless of their names,
then there's no problem. Does anyone know why this would happen?