Question

I am using emacs for learning clojure. I have leiningen installed. This is how my general workflow goes :

Open eshell in emacs

run lein new myapp

cd myapp\src\myapp\core.clj

write some code.

M-x cider-jack-in to open the repl

Now when i try C-c C-k to load the file in the repl, it does not go in that but instead in the small emacs command window.

My functions are also not visible in the repl.

How do i connect the clojure mode to the repl created with cider-jack-in ?

Was it helpful?

Solution

Clojure is different from many languages because the unit of compilation is the top level expression. So when you hit C-cC-k, cider-mode will run the equivalent of load-file on the current buffer and display the result of load buffer in the minibuffer (the space at the bottom of the screen). When evaluating Clojure the result of loading a buffer is the last s-expression in that buffer so when evaluation finishes the result of evaluating the bottom of the file will be briefly displayed at the bottom of the screen.

Once you have loaded the file, you can switch the REPL to that namespace by typing C-cM-n

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top