Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: compile error in unknown global in strict mode: vim #22

Closed
bangedorrunt opened this issue Aug 18, 2021 · 7 comments
Closed

bug: compile error in unknown global in strict mode: vim #22

bangedorrunt opened this issue Aug 18, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@bangedorrunt
Copy link

bangedorrunt commented Aug 18, 2021

I got this error whenever I open nvim.

Screen Shot 2021-08-18 at 9 18 58 pm

Edit: I just want to confirm that this bug doesn't happen with aniseed using the same nvim config

@rktjmp
Copy link
Owner

rktjmp commented Aug 18, 2021

There was a bug fix in Fennel 0.10 with strict reporting, so that may be why you're seeing it in Hotpot, or Aniseed fiddles with the globals.

These might be related:

#16
#19

Are you using vim in a macro or just regular old fennel? I have no trouble accessing vim in "normal" code but macros are sandboxed by Fennel intentionally.

@bangedorrunt
Copy link
Author

You're right. I got some vim.* in macros

@rktjmp
Copy link
Owner

rktjmp commented Aug 18, 2021

Try _G.vim

@rktjmp
Copy link
Owner

rktjmp commented Aug 18, 2021

_G.vim will still show a warning if you nvimv 2> stderr.log, but it is "non fatal" atm and you will only see the error when that module is being compiled.

I do plan to expose compiler configuration #14 which will let you pass options to Fennels compiler to avoid this.

The reason I don't just set it up to allow vim by default (even though its not unreasonable to do since we're always in Vim) is that I want Hotpot to "just be Fennel", so it retains any defaults that come with it.

Edit: Aniseed runs with the sandbox disabled which is why you don't see the error https://github.com/Olical/aniseed/blob/c364acfb58a2185e8cf6a0dc5ef91b0aa1024562/fnl/aniseed/compile.fnl#L29-L30

@bangedorrunt
Copy link
Author

Thank you for details. IMO, it's worth to fix this, especially for new neovim users who want to use fennel for their config using hotpot. Apart from this, hotpot is working great for me 👍. Feel free to close this issue if you don't consider to fix it. Thank you!

@rktjmp rktjmp added the enhancement New feature or request label Aug 26, 2021
@rktjmp
Copy link
Owner

rktjmp commented Sep 9, 2021

Merged compiler options, see :h hotpot-setup or readme for configuration guide and the fennel lang site for options, or in my config I use:

  require("hotpot").setup({
    compiler = {
      macros = {
        env = "_COMPILER",
        compilerEnv = _G,
        allowedGlobals = false,
      }
    }
  })

Note you will still technically see errors in stderr until this commit is released in the next fennel release which fixes a bug in Fennel not actually propagating the options down to the compiler.

@rktjmp rktjmp closed this as completed Sep 9, 2021
@rktjmp rktjmp pinned this issue Sep 9, 2021
@bangedorrunt
Copy link
Author

Wow, that's great news. Thank you so much 😘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants