zest.nvim
zest.nvim copied to clipboard
def-keymap-fn throws error
def-keymap works but def-keymap-fn throws this:
; Sponsored by @rafaeldelboni ❤
; --------------------------------------------------------------------------------
; eval (file): ...s/nvim/.config/nvim/fnl/dotfiles/mappings.fnl
; Compile error in /home/p00f/.local/share/nvim/site/pack/packer/start/zest.nvim/fnl/zest/macros.fnl:117
; unknown global in strict mode: ZEST_VLUA_23_auto
;
; `(.. ":call " ZEST_VLUA# "()<cr>"))
; * Try looking to see if there's a typo.
; * Try using the _G table instead, eg. _G.ZEST_VLUA_23_auto if you really want a global.
; * Try moving this code to somewhere that ZEST_VLUA_23_auto is in scope.
; * Try binding ZEST_VLUA_23_auto as a local in the scope of this code.
when i do
(import-macros {:def-keymap-fn fmap
:def-keymap kmap} :zest.macros)
(kmap :<C-n> [n] ":bnext<CR>")
(fmap :de [n] (print 1))
What plugin do you use to compile fennel, I tried it out and it didn't seem like a problem.
aniseed
That's conjure's eval buffer, right? It could be just conjure not liking the globals.
I believe aniseed's compiler allows them, though. Does it create the binding successfully?
aniseed doesn't like it either
Found the bug,
Fennel deprecated unknown globals with v10.0,
Aniseed uses fennel v10.0,
conjure also uses aniseed to compile.
Thanks!
Well, that's one more reason to move over to runtime. As it is right now, one either has to explicitly disable strict globals or use an older version of fennel to compile.
I'm pretty busy with uni at the moment, but I'll get to it when I can.
Yeah, I also use v0.9.2 to compile because of macros.
Thanks!
Here is a quick dirty solution to this:
(fn local-getter []
'(fn [xs#]
(for [i# 1 20]
(let [(name# local-val#) (_G.debug.getlocal 2 i#)]
(if (= name# xs#)
(lua ,(.. "return " (view 'local-val#)))
(not name#)
(lua :break))))))
Usage:
; inside macro
(local get# ,(local-getter))
(get# ,(view 'ZEST_VLUA#)) ; tostring can also be used instead of view
btw I think conjure uses aniseed's compiler - i downgraded aniseed to 3.20 and i could evaluate this
If aniseed is installed conjure uses it as it compiler
Oh this should also be fixed by #8, you can use my fork until it's merged too.
It's not so much to do with the unknown global crack down, I don't think. It's mostly to do with how they enforce gensyms across syntax quote boundaries correctly now.