Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure - start a REPL without a project.clj

I started using Clojure with leiningen (and now boot).

Now I sometimes want to get quickly to a Clojure{Script} CIDER REPL in Emacs to execute just a few instructions. I don't want to create a project.clj file for that, since I just want a throwaway REPL.

Is there a way to get a Clojure REPL, for instance in the *scratch* buffer ?

like image 741
nha Avatar asked Oct 12 '15 21:10

nha


People also ask

How do I start a REPL Clojure?

To start a REPL session in Eclipse, click the Menu option, go to Run As → Clojure Application. This will start a new REPL session in a separate window along with the console output.

How do you abruptly stop execution in the REPL?

There is no way to stop execution. On those versions CTRL-C will lead to termination of the whole scala REPL.

How does Clojure REPL work?

A Clojure REPL (standing for Read-Eval-Print Loop) is a programming environment which enables the programmer to interact with a running Clojure program and modify it, by evaluating one code expression at a time.

How do I get out of Lein REPL?

Using the CLI tools You can exit the REPL by typing Ctrl+D (pressing the Ctrl and D keys at the same time).


2 Answers

well, you can execute M-x cider-jack-in anywhere you want, even with no project.clj in path. This works for me.

like image 50
leetwinski Avatar answered Oct 14 '22 03:10

leetwinski


You can just type lein repl in the friendly console / shell / terminal right next to you -- no project.clj required. This will start a REPL as expected, to which you can then connect from Emacs via M-x cider-connect (which in recent versions will handily suggest host and port to connect to). M-x cider-jack-in basically does the same thing (i.e. lein repl) behind the scenes.

I'm not a boot user, but according to the boot wiki for leiningen users it should be possible to call boot repl -s.

like image 32
schaueho Avatar answered Oct 14 '22 04:10

schaueho