Closed Akeboshiwind closed 9 months ago
Looks to me like you have macro.fnl
but you're trying to require macros.fnl
? I think? I hope it's as simple as that 😅
Ah, good catch!
I'm still having a problem with this in my dotfiles but I'll try and find an actual reproduction of it 🤔
For now here's the actual error message I'm getting:
<snip>/.config/nvim/fnl/plugins/copilot.fnl:2:0 Compile error: <snip>/.config/nvim/fnl/macros.fnl:14:3 Compile error: tried to reference a macro without calling it
{: call-in}
* Try renaming the macro so as not to conflict with locals.
(import-macros {: call-in} :macros)
* Try renaming the macro so as not to conflict with locals.
What's weird is that if I instead import nfnl.macros
it compiles just fine.
Alright, I figured things out.
Turns out the problem was that I was defining the macro in macros.fnl
using macro
not fn
.
Full reproduction of the error:
mkdir /tmp/test
cd /tmp/test
touch {macro,.nfnl,file}.fnl
echo ";; [nfnl-macro]\n(macro test [])\n{: test}" > macro.fnl
echo "(import-macros {: test} :macro)\n(test)" > file.fnl
compile() { nvim $1 --headless -c "lua vim.notify = function(msg) local f = io.open('/dev/stdout', 'a'); f:write(msg .. '\n'); f:close() end" -c 'write' -c 'quit' }
compile macro.fnl
compile file.fnl
So this looks like an error on my part, I'm guessing that macro
defines the macro locally to the file and so there's nothing to export/import.
Problem
When I write a macro file and try to import it I get an error
Compile error: macros module not found.
Reproduction
nfnl version: 7ef3da2
A similar setup as #12:
If I try and compile
file.fnl
I get:Compile command
```sh nvim file.fnl --headless -c "lua vim.notify = function(msg) local f = io.open('/dev/stdout', 'a'); f:write(msg .. '\n'); f:close() end" -c 'write' -c 'quit' ```