0

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 ?

Ashish Negi
  • 5,193
  • 8
  • 51
  • 95
  • What do you mean with "small emacs command window"? And which version of cider are you using? – schaueho Jun 05 '14 at 12:08
  • when i press `M-x` it shows up in the bottom of emacs window. that is command window; i hope – Ashish Negi Jun 05 '14 at 12:10
  • That's the so-called [mini buffer](https://www.gnu.org/software/emacs/manual/html_node/emacs/Echo-Area.html#Echo-Area). I can't verify the behavior you describe. – schaueho Jun 05 '14 at 12:20
  • Does your file load in the repl created with cider-jack-in ? – Ashish Negi Jun 05 '14 at 12:39
  • what is the "it" that goes in the minibuffer? if you mean the result of loading the file, that is intentional. If you want to see the result in the repl, then load the file from the repl. Similarly if you do not paste functions into the repl, you will not see them there, even if you use the keypress to make the repl load your function. This is all how cider is supposed to work. – noisesmith Jun 05 '14 at 15:00

1 Answers1

2

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

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284