Fulcro development with Emacs+Cider

Using Emacs+Cider for development with Fulcro. To set up Emacs for Clojure and ClojureScript development with Cider see e.g.: My Emacs configuration

Start headless REPL

Start a headless REPL.

1JVM_OPTS="-Ddev" lein repl :headless

Jot down the port on which the nREPL server started.

Connect to REPL (for Clojure)

In Emacs use M-x cider-connect to connect to the REPL. Normally you can use the default (localhost) and also press ENTER for the port number (which automatically finds the port number). If it doesn't work then use the jotted down port number.

Start the server in the Clojure REPL


Create a second connection to the REPL (for ClojureScript)

In Emacs use M-x cider-connect to again connect to the REPL. On the question REPL buffer already exists (*cider-repl localhost*). Do you really want to create a new one? (y or n) answer y.

Initialize the ClojureScript REPL

In the ClojureScript REPL type the following command:


Load or reload the page

The ClojureScript REPL reports Prompt will show when Figwheel connects to your application, which occurs when the page with the ClojureScript code is loaded or reloaded.

Get initial- and current state

Sidetracking, on how to get initial- and current state in the Fulcro template project.

To see the initial state, use the following from a cljs repl:

1(fulcro.client.primitives/get-initial-state fulcro-template.ui.root/Root {})

To see the current state, use the following from a cljs repl:

1@(fulcro.client.primitives/app-state (get @fulcro-template.client/app :reconciler))

Manage repl connections

Sometimes you require a specific repl to be the active connection for a source file. E.g. for .cljc files. There is a section in the CIDER documentation on this: Managing Connections.

Screendump with Fulcro template project

Posts in this Series