Comment by wilsonmitchell

6 years ago

I recently picked up this tool and picked up someone's config that does some modal keybindings similar to spacemacs [1]. It actually inspired me to hack around with their config and then write a spacemacs layer for fennel-mode which someone had written a decent version of already [2]. I'm a bit of an emacs and fennel noob, but it seemed like a fun little problem to solve. I'm especially interested in getting autocomplete working better. I've been trying to base things off of other lisps' layers, but all ears for any tips on how to approach it. I'll edit in my github later as I have everything local at the moment.

[1] https://github.com/agzam/spacehammer [2] https://gitlab.com/technomancy/fennel-mode

Hi, I'm the author of Spacehammer. You may want to check development branch of the project. There are some major improvements. Sadly I've been swamped with work lately and having trouble finding more time to work on it. One of the things I'm banging my head around is adding a REPL that can work with Hammerspoon's IPC. Once I figure that out, I'm planning to experiment on a bunch of new things and improve existing features.

  • My idea is to extend fennel-mode with a fennel-hs-mode that will take preprocess code by removing newlines[1] and wrapping in something like

      fennel.eval([=[ (code) ]=])
    

    and then sending to the hs cli.

    I haven't done much yet; this is the first time I've tried to write a real Emacs mode. It would be much nicer to have a real Fennel REPL integrated in Hammerspoon, but the above would be enough for things like eval-last-sexp and org-babel-eval.

    [1] Sadly, the hs cli does not handle multi-line strings.

  • Oh very nice. I will check that out more later. Definitely love the concept and would be interested in hearing if you have any future plans. I thought it could be cool to define major and minor modes like emacs that you could also "autoload" based on application names or types or even use what monitors are plugged in/wifi/times of day to switch. I suppose you have major modes already with what application is focused.

    A Spacehammer REPL would be huge for prototyping/developing new features in Fennel. My github is mitchellw. Would love to help out :)

Take a look at lsp-mode for auto-completion, syntax checking, etc. I think it already works well for Lua. Should be possible to do it for fennel too.

  • Yeah I think it should be possible to at least autocomplete parts that can be identified as the "lua bits" of Fennel. Just gotta dig in a bit more.

Is your fennel-mode spacemacs layer published on github or elsewhere? I couldn't find it in the spacemacs develop branch.