Closed nbardiuk closed 3 years ago
It will be called group_body
in the compiled Lua, not group-body
, this is a quirk of Fennel, kind of. Lua doesn't support names with hyphens in them so Fennel compiles all names to Lua compatible equivalents which we have to bear in mind when referencing at runtime from something other than Fennel. You should be able to see the name in the compiled Lua output.
This should do the trick: lua require('repro')['group_body']()
Sorry, my reproduction example is a bit missleading, I actually don't have dashes in my actual config.
This autogroup setup works in everyday situations, it breaks only if I try to evaluate some expression in the modules buffer using conjure/aniseed.
Hm okay, odd! And just to confirm, do the filename and module names line up in your real code? Because if your file is foo/bar.fnl
and your module name isn't foo.bar
you'll also run into issues.
Yes, in real code everything is in ~/.config/nvim/fnl/init.fnl
and module name is init
.
So, just a hunch, but is it still broken after the very latest commits I made in the last ~30 mins? I just fixed something around interactive evals + the module macros. It was sometimes putting the module macros into static compilation mode which produces efficient Lua (for writing to static Lua files) but wipes the module table which could cause the behaviour you were seeing.
Which would explain it breaking semi-recently since I only recently started to distinguish between "static" and "dynamic" evals / module macros which focus on different things. One being efficiency and wiping whatever is there already, the other augmenting whatever is currently in the environment with smarter, slower, dynamic code.
Perfect timing! With the latest commit it works like a charm. Thank you!
Wonderful! Sorry if it caused you issues for a while though!
I am using aniseed to configure some autogroups in my neovim. After recent plugin update I've started noticing lua errors when opening buffers.
Below is minimal example how I define autocmd:
This setup works in general but breaks when I evaluate any expression using conjure/aniseed inside this
repro
module, like simple(+ 1 1)
It looks like when I evaluate expression in
repro
module thegroup-body
function dissapears from vim runtime.Is there a better way to define vim autocmd that uses fennel code and supports conjure/aniseed evaluations?
Versions: