0

I am new to Clojure and I am using one of Eirc Normad's course to learn.

After following the instructions, I do a git clone of:

git clone https://github.com/lispcast/introduction-to-clojure.git 

Until this point, Eric does not emphasize Emacs' use. But, I would like to use Emacs, since I am used to it.

In Emacs, after opening the file project.clj, I executed cider-jack-in. A message is echoed by the mini-buffer about the nREPL indicating that the server has been started:

enter image description here

The situation stays like this for a long time without anything changing.

I must say that I have successfully used CIDER and Emacs in other Clojure projects. Especially, if I start some Clojure project from scratch, e.g. after a $ lein new my-new-project .

In addition, although CIDER does not work after the git clone suggested by Eric's material, things do work as expected after openning eshell and executing $ lein repl, see below:

Welcome to the Emacs shell

 ~/projects/introduction-to-clojure   master $ lein repl
Welcome to the bakery!

Available commands are: 
grab           Pick something up.
squeeze        Squeeze whatever you are holding.
release        Release whatever you are holding.
scoop          If you are holding the cup, fill it with an ingredient.
add-to-bowl        Add the ingredient you are holding to the mixing bowl.
mix            Mix the ingredients in the bowl.
pour-into-pan      Pour the contents of the bowl into the pan.
bake-pan       Put the pan in the oven for a certain number of minutes.
cool-pan       After baking, put the pan on the cooling racks to cool.
           Returns the id of the cooling rack.
status         Print out the status of the bakery.
start-over     If you get lost, this command will reset the bakery.
go-to          Go to the given location.
           Possible locations are :prep-area, :fridge, and :pantry.
load-up        Load an ingredient from storage to take to the prep area.
unload         Unload an ingredient in the prep area.
get-morning-orders Get a new list of baking orders.
delivery       Notify the delivery bot that something is ready to deliver.

bakery-help      Print out this message.
[Rebel readline] Type :repl/help for online help info
introduction-to-clojure.core=> 

I am clueless about why it does not work in this particular case.

The buffer Messages indicates:

[nREPL] Starting server via /run/current-system/sw/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"0.9.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.28.5\"\] -- repl :headless :host localhost
Quit [2 times]

Moreover, things get even weirder when inspecting the `nrepl server. Things seem to have worked! The REPL seems to be working. There is even a starting message from the project being printed:

Welcome to the bakery!

Available commands are: 
grab           Pick something up.
squeeze        Squeeze whatever you are holding.
release        Release whatever you are holding.
scoop          If you are holding the cup, fill it with an ingredient.
add-to-bowl        Add the ingredient you are holding to the mixing bowl.
mix            Mix the ingredients in the bowl.
pour-into-pan      Pour the contents of the bowl into the pan.
bake-pan       Put the pan in the oven for a certain number of minutes.
cool-pan       After baking, put the pan on the cooling racks to cool.
           Returns the id of the cooling rack.
status         Print out the status of the bakery.
start-over     If you get lost, this command will reset the bakery.
go-to          Go to the given location.
           Possible locations are :prep-area, :fridge, and :pantry.
load-up        Load an ingredient from storage to take to the prep area.
unload         Unload an ingredient in the prep area.
get-morning-orders Get a new list of baking orders.
delivery       Notify the delivery bot that something is ready to deliver.

bakery-help      Print out this message.
[Rebel readline] Type :repl/help for online help info

introduction-to-clojure.core=> 

The REPL is also adjusted to the namespace. However, it does not eval the expressions that I insert:

introduction-to-clojure.core=> (+ 1 2)


;; does not return any output

In case this is relevant, I am using NixOS as OS. This is my NixOS' config file. In addition, this is my Emacs config file.

1 Answer 1

0

The project was set up by the author to be the best for as many people as possible, so Eric Normand included a clojure library called Rebel Readline. This library addition is the root of the problem.

It is possible to disable it by commenting out the :aliases line in the project.clj, here. After this change, it will start a more normal REPL that is compatible with CIDER (Emacs).

The content of this answer was kindly provided by Eric via private email. Errors and omissions are my responsibility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.