Olical / aniseed

Neovim configuration and plugins in Fennel (Lisp compiled to Lua)
https://discord.gg/wXAMr8F
The Unlicense
606 stars 28 forks source link

Can't require-macros, module not found #112

Closed D00mch closed 2 years ago

D00mch commented 2 years ago
╰$ nvim --version
NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@HMBRW-A-001-M1-004.local

Aniseed from master. macros.fnl is copied to .confgi/nvim/lua/macros.fnl

image

Olical commented 2 years ago

Can you not require-macros [macros]? I can't remember right now and I'll look deeper tomorrow but you shouldn't need the fnl prefix, maybe some old documentation told you to do that?

Also I would recommend moving your modules under a sub-directory so they're not directly under fnl/lua. That risks your file / module names colliding with other things at the top level, maybe it'll be fine, but I think it's good practice to have something like fnl/dotfiles/my-code.fnl.

D00mch commented 2 years ago

Yes, I guess the problem is in the fnl prefix, which I get from the docs. I removed it but now I have

image

This error with the macros from the fennel-lang.org/macros

{:thrice-if2 
 (fn [condition body]
   (fn step [i]
     (if (< i 3
            `(if ,condition (do ,body ,(step (+ 1 i))))))
     (step 0)))
D00mch commented 2 years ago

For example, if I announce the same macro with macro keyword, I can use it int the same module:

(macro thrice-if [condition body]
  (fn step [i]
    (if (< i 3)
      (list (sym :if) condition (list (sym :do) body (step (+ 1 i))))))
  (step 0))
D00mch commented 2 years ago

I had a typo. So, everything words, if you provide path without fnl. prefix.