hotpot.nvim
hotpot.nvim copied to clipboard
`(include mod)` depends on CWD / fennel.path value
Hm..
test/macros.fnl
does use include and builds without issues.
Using elsewhere seem fails to find the module.
- Does
fennel.include
hit the regular infra or use its own file searcher?
Seems it uses specials.search-module
(fn search-module [modulename ?pathstring]
(let [pathsepesc (escapepat pkg-config.pathsep)
pattern (: "([^%s]*)%s" :format pathsepesc pathsepesc)
no-dot-module (modulename:gsub "%." pkg-config.dirsep)
fullpath (.. (or ?pathstring utils.fennel-module.path)
pkg-config.pathsep)]
(fn try-path [path]
(let [filename (path:gsub (escapepat pkg-config.pathmark) no-dot-module)
filename2 (path:gsub (escapepat pkg-config.pathmark) modulename)]
(match (or (io.open filename) (io.open filename2))
file (do
(file:close)
filename)
_ (values nil (.. "no file '" filename "'")))))
Which uses utils.fennel-module.path
, require("fennel").path ==
./?.fnl;./?/init.fnl`
Testing include b
from fnl/
does work, so its a fennel.path issue.
- patch fennel.path to match package.path (really needs to match vim "rtp", package.path will not be sufficent) OR
- ... cwd to match fnl/ when compiling? Probably not OR
- patch fennel?
We now just insert fnl/
into the relevant paths when compiling, then undo any change.