dundalek/closh

Contributing

dogma0 opened this issue · 2 comments

Hi,

This is project seems amazing, I've been using Closh personally and at work for the past week. I'm pretty interested in digging more into the internal and contributing.

But I've only done a bit of Clojure with lein - I made a game following Clojure for the Brave and True. So I don't have a lot of knowledge about Clojure beside using the clojure core. I see that the Closh uses boot and I'm not sure how to load all the namespaces in to tinker in the repl.

Do you have tips or recommendations for reading so I can start to understand how everything is pieced together in Closh and hopefully contribute after? One idea I have is to make Closh work better with emacs (I use spacemacs) - I tried using vterm with Closh, it wasn't great. I couldn't hold alt and jump by word. And I also think that it'd be very nice if I could use some structural editing with Closh. To do that I think I need to build/extend the terminal environment to do that.

Either way, any advice would be appreciated. Hopefully, it'd also help other people to start contributing to this project. Thanks and great work!

Hi, thanks, I'm glad you like it.

I actually use primarily clojure main and deps. Boot is only used for compiling and bundling into the final jar file. It is used mostly for historical reasons. If I find a good library that uses clojure main with deps and works well, I would replace Boot.

To start REPL you can run following from the project directory:

clojure -Sdeps "{:deps {nrepl/nrepl {:mvn/version \"RELEASE\"}}}" -m nrepl.cmdline

It will print out nREPL port to which you can connect from your favorite clojure-enabled editor. Then you can require and evaluate namespaces like usual.

I have a global alias for it so I just type clojure -Anrepl.

When you run the bundled jar it runs the rebel frontend. You can run it from sources with clojure -m closh.zero.frontend.rebel. Even simpler frontend is closh.zero.frontend.main which does not have the fancy interactive mode. So you could start there and follow functions top-to-bottom from there to get an idea how things are put together. Another helpful thing might be to look at the unit tests to see how the functions are called and what are their inputs.

The interactive editing is done using rebel-readline which does all the heavy lifting. It internally uses jline library which is written in Java, so it is not so nice to hack on.

For more advanced things like structural editing I keep my eyes on liquid which is a pure clojure text editor implementation. It is very customizable since everything is just function composition, so I think it should be possible to hook it into closh and implement all the editing features one could imagine. It sound like integrating liquid and closh might be an interesting project to you ;)

I am pretty busy preparing for a talk I will give at ClojureD conference at the end of February. But after that I suppose I could reuse some diagrams from it and write down more detailed documentation.

Hey thanks for the reply and the links. I didn't even know there are those key bindings (with scroll-able documentation?! ). Okay, I'll take all these info in and tinker with the code and liquid - my gut tells me I can finish it or at least have some progress before for your talk ;)