-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cannot import .so file in a macro file #33
Comments
Thanks for all the testing you're doing and thanks for the detailed repro. I can't get this to work with core Fennel, See my fork: https://github.com/rktjmp/hotpot-issue_33 and run the fennel test
Not sure if this is intentional on Fennels part or an oversight, the macro code has some specific rules around it. It does have a specific This might be a wontfix, temporarily? Just not sure if it's a fix for upstream, intentional or if hotpot should just be cloning over some path values somewhere. Basically if you can make it work with the fennel binary, then 100% we will make it work in Hotpot. I might have just mis-wrote the option out. As some background, all the code run in macros is handled by Fennel. When you call hotpot.nvim/fnl/hotpot/searcher/macro.fnl Lines 19 to 33 in 657c208
We can pass options there, so if there is an option that lets fennel find the module, we can do that. Of course there could be issues with path's being set/passed correctly, but that it works in normal modules tells me that they are working OK and shouldn't need tweaking. Note that I am using the |
Obviously it would be nice if this did work. |
I did some AFK thinking and realised why it doesn't work. I neglected to poke at the cpath properly before (too sleepy 💤). Fennel (and Lua in general) has a fallback system for the package finders. You can read more about this in the lua docs, re: With hotpot and normal fennel, the searchers roughly go: But the macro searcher in Fennel doesn't inherit from that list, it has its own. Specifically the list: (local macro-searchers [lua-macro-searcher fennel-macro-searcher]) Since these searchers don't look at Again, I am not sure if this is intentionally omitted or just forgotten. I could patch the hotpot searcher to look at the cpath but it's supposed to be "last in the list" and I am not 100% on how to even load a |
You can do this, rktjmp/hotpot-issue_33@caf7851 to insert the two final lua loaders into the macro searchers. It will incur a start up penalty as you now have to load fennel every boot, or you could just comment/uncomment it when you make changes to those macro files. My first attempt was to put that code in the macro file and try to just effect the searcher when loading that one file but I don't really endorse doing this though, it's relying on things being in a "probable state". |
Thanks! I will do some testing with what you told me and maybe open an issue on the fennel repo. Thanks a lot! |
I actually asked on the IRC channel,
If you do make sure you include a fennel repro, not a hotpot one to avoid any confusion. Opening an issue at least lets it get tracked. |
Thanks! I saw that on the IRC channel. Fun fact: this all began because I wanted to use a regex expression that uses |
|
I mean an optional capture group like: (no)?(\w+)
|
Bummer dude. |
I opened an Issue in the Fennel repo for tracking purposes, you can see it here: bakpakin/Fennel#391 |
I tested the patch recommended by @technomancy and it works, you can see it in this branch. I also tested it in my hotpot configuration and it seems to work. I think this issue can be closed now. Maybe the patch can be added to a FAQ or something. |
I don't know much about hotpot but if it has compiler sandboxing disabled already then including this macro searcher in hotpot itself might be the way to go? |
Hotpot aims to be "just Fennel", so it can disable the sandbox but doesn't by default, and won't patch this loader in by default either unless it were to be up streamed in someway. As is, I think the user inserting the c-loader as shown is the solution. Hotpot might (should?) get an optional hook interface so you can lazily insert the loader without having to directly require fennel, so you can avoid the startup time cost of Probably is worth noting the work around somewhere in the Fennel docs, or at least noting the limitation in the macro docs and why. |
OK yeah if it's sandboxed then that's not a great idea. I'll add an explanation in |
Hello! I am here, again, with another bug.
This time the bug is related to trying to require a luarock module from a fennel macro file. I am trying to use this luarock inside my macro file to process strings using PCRE2 regexes.
As you can see in the next screenshot, the luarock can be required from
init.lua
andinit.fnl
, but it cannot be required frommacrofile.fnl
.How to reproduce
Learning from past issues, I created this repository that contains how to reproduce the bug using docker.
My suspicions
I am using this:
To make neovim able to source luarocks as Lua modules. This is the way that packer recommends and uses.
Maybe the bug is related to the
package.path
variable.The text was updated successfully, but these errors were encountered: