Cider: Cannot start repl outside of a project when not using Lein

Created on 29 Aug 2016  ·  6Comments  ·  Source: clojure-emacs/cider

Expected behavior

cider-jack-in should work when using boot, with leiningen absent

Actual behavior

The lein executable isn't on your 'exec-path'

Its value is
("/usr/local/scripts" "/usr/local/bin/" "/usr/bin/"...)

boot.sh and a symlink to it named boot are in /usr/local/scripts

cider-lein-command is "lein"
cider-boot-command is "boot", I have also tried "boot.sh"

I have experienced this on Arch Linux and Gentoo Linux, with emacs 24 and 25. Leiningen works as expected, when it is installed, but I would prefer to use boot.

Steps to reproduce the problem

Install Spacemacs (one git clone command)
https://github.com/syl20bnr/spacemacs#install

Enable the 'clojure' layer in Spacemacs

Install boot

Follow the 'Quick Start with boot' instructions for the clojure layer
http://spacemacs.org/layers/+lang/clojure/README.html

Attempt to cider-jack-in or 'SPC m s i' in Spacemacs

CIDER version information

Cannot launch a REPL from within emacs, but cider-20160825.249

When launching a boot repl from the CLI, which works, REPL-y 0.3.7, nREPL 0.2.12, Clojure 1.7.0

Lein/Boot version

BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.7.0
BOOT_VERSION=2.6.0

Emacs version

25.0.95.1

Operating system

Gentoo GNU/Linux

bug

Most helpful comment

I guess this should be easy to fix. I'll look into it.

All 6 comments

What happens when you execute this bit of Elisp (executable-find "boot") (e.g. by usingielm or M-:)?

It's "/usr/local/scripts/boot", which is correct. Running '/usr/local/scripts/boot repl' from a command line works perfectly.

It seems like it's only checking for the presence of Lein, and never getting to the point of checking for Boot...

I started poking around into the source again, to try to figure this out. It looks like Cider needs a better way of figuring out what kind of build tooling you're using.

I suggest actually _looking_ for lein, boot, etc. before trying to call one of them.

Currently Cider only looks for build files - project.clj for lein, build.boot for boot, build.gradle for gradle. If it doesn't find one, it assumes lein.

I made an empty, useless build.boot file, and now Cider is working perfectly, from within this 'project'. This shouldn't be required to start a repl using boot. The function cider--identify-buildtools-present _really_ needs to be more thorough.

If that function stays as-is, it shouldn't default to lein - it should default to searching for any tooling that's actually present on the system.

(executable-find "blah") seems to work very well, so I'll start working on a pull request to fix this. I would appreciate it if more experienced devs would do the same, I may not be successful.

Okay, to fix this, it looks like I would have to completely tear apart the cider-project-type function. I don't feel at all comfortable doing that. But anyway, here is the masterful elisp I have constructed so far:

(or (executable-find cider-lein-command) (executable-find cider-boot-command) (executable-find cider-gradle-command))

That returns the first of the three that is present, and should be the default executable if no project.clj, build.boot, or build.gradle is present.

I guess this should be easy to fix. I'll look into it.

Ah, seems I forgot about how this was supposed to be used - just set cider-default-repl-command to "boot".

Was this page helpful?
0 / 5 - 0 ratings