Search code examples
buildclojurescriptread-eval-print-loopcidershadow-cljs

How to make the connection between Emacs, Cider, and shadow-cljs be less repetitive per project?


I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame, reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.

Usually, I build the project by executing the command cider-jack-in-cljs in Emacs, choosing shadow-cljs, then shadow for REPL type, and, finally, app for the building option.

Every time I execute cider-jack-in-cljs, I end up retyping the same things.

I would like to make this process more automatic. Also, I would like to avoid manual tweaks inside CIDER's package local files.

How to do it?


Solution

  • At the root of the project, create a file called /Users/pedro/projects/your-project/.dir-locals.el

    Make the content be:

    ((nil . ((cider-preferred-build-tool . shadow-cljs)
             (cider-default-cljs-repl . shadow)
             (cider-shadow-default-options . ":app")
             (cider-shadow-watched-builds . (":app"))
             (cider-offer-to-open-cljs-app-in-browser . nil))))
    
    

    Now, it is only necessary to execute cider-jack-in-cljs for this specific project.