1
votes

I am trying to use Emacs and Cider for Clojure development.

I have installed Cider and Java JDK 7 and also (I think) I have installed Leiningen. I use Ubuntu 14.04 and I saved the lein file for the Leiningen installation in my home directory, made it executable and run it. After that I don't know how to start programming using Emacs and compile my code. I have searched everywhere and after all the installations a lot of internet sources mention to try M-x cider-jack-in. When I do that I get:

"The lein executable (specified by `cider-lein-command') isn't on your exec-path"

Also I have searched every question regarding Clojure and Emacs in this site and also in the first 3 pages of Google. I mean each and every one of them.

3

3 Answers

6
votes

Emacs doesn't know where your lein is installed. You have two options:

  1. Move lein.

As root, move lein to /usr/bin/

if you want to keep a copy in ~
# ln -s ~/lein /usr/bin/ 
if you don't want to
# mv ~/lein /usr/bin/  

  1. Tell emacs where to find lein.

Unfortunately, your home folder is not a good place. Directories in the path should be kept as clean as possible. Usually, you'll want to have a folder like ~/bin/ where you store such files. In which case, you can execute:

PATH=$PATH:~/bin/

In a shell. If you want to make this permanant, put this line in ~/.bashrc (or .zshrc if you use zsh).

1
votes

I suggest you to give Lighttable a try and also this tutorial to see the great integration LightTable has with Clojure and ClojureScript, as inline evaluation (Ctrl+enter) and documentation with (Ctrl+d) with almost no setup, you can easily add emacs keybindings through a plugin. The tutorial is about ClojureScript but the core language is very close

In my experience is harder and takes more time to get an equivalent dev environment with raw emacs but if you stick with it I suggest you to check http://batsov.com/prelude/ with clojure-mode activated

0
votes

Emacs searches binaries in 'exec-path'. Say 'lein' is in '/usr/local/bin/lein'. You can add to .emacs file (setq exec-path (cons "/usr/local/bin" exec-path))