Fork me on GitHub
#cider
<
2023-09-30
>
john2x01:09:10

is there a template to start a basic project with cider dependencies and integrations all set up? I just want to start playing with the repl basically.

jpmonettas01:09:43

if it is just for playing you can open emacs, do a cider-jack-in and it can start and connect to a repl without any project. You can then create a .clj file or just put any buffer in clojure-mode and start playing with clojure

john2x01:09:14

oh TIL. That's awesome, thanks!

jpmonettas01:09:14

next step if you want to start creating a project and adding some dependencies you can :

$ mkdir my-project 
$ cd my-project
$ echo '{:deps {hiccup/hiccup {:mvn/version "2.0.0-RC1"}}}' > deps.edn
then open that deps.edn file in emacs and do the cider-jack-in while on that file. It will start a repl but this time with those dependencies loaded

💯 2
john2x01:09:01

heh, that was going to be next question, how to gradually add dependencies

jpmonettas01:09:17

also if you have one of the latest clojure cli installed, instead of adding that dependency there you can create your deps.edn like this :

echo '{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha4"}}}' > deps.edn
and start a repl with that, and no other dependency. That will start a repl with clojure 1.12 which has a nice feature to add libs on the fly, just by typing on your user ns :
user> (add-lib 'hiccup/hiccup {:mvn/version "2.0.0-RC1"})
or whatever library you want to play with, without restarting the repl

practicalli-johnny13:09:41

If you look in the Emacs messages buffer after the jack-in command, you can see the full command that cider uses to start the REPL. Useful if you ever need to customise what command cider runs

practicalli-johnny13:09:33

For future reference, the simplest way to customise repl start up is via a .dir-locals.el file, including aliases to run that provide additional tools https://practical.li/spacemacs/clojure-development/project-configuration/