Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start repl outside of a project when not using Lein #1835

Closed
carbohydratesn opened this issue Aug 29, 2016 · 6 comments
Closed

Cannot start repl outside of a project when not using Lein #1835

carbohydratesn opened this issue Aug 29, 2016 · 6 comments
Labels

Comments

@carbohydratesn
Copy link

carbohydratesn commented Aug 29, 2016

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

@bbatsov
Copy link
Member

bbatsov commented Aug 30, 2016

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

@carbohydratesn
Copy link
Author

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...

@carbohydratesn
Copy link
Author

carbohydratesn commented Sep 1, 2016

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.

@carbohydratesn carbohydratesn changed the title Cannot start repl with boot, when lein is not present Cannot start repl outside of a project when not using Lein Sep 1, 2016
carbohydratesn added a commit to carbohydratesn/spacemacs that referenced this issue Sep 2, 2016
As an absolute beginner, this took a while to figure out, and eventually required reading through Cider's source files.  

Currently, there *must* be a build.boot file present - an empty one works - if you want to start a repl through cider with boot.

clojure-emacs/cider#1835
carbohydratesn added a commit to carbohydratesn/spacemacs that referenced this issue Sep 5, 2016
Moved to develop branch, original pull request -

syl20bnr#7003

As an absolute beginner, this took a while to figure out, and eventually required reading through Cider's source files.

Currently, there must be a build.boot file present - an empty one works - if you want to start a repl through cider with boot.

clojure-emacs/cider#1835
@carbohydratesn
Copy link
Author

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.

@bbatsov
Copy link
Member

bbatsov commented Oct 11, 2016

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

@bbatsov
Copy link
Member

bbatsov commented Oct 12, 2016

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

TheBB pushed a commit to syl20bnr/spacemacs that referenced this issue Oct 17, 2016
Moved to develop branch, original pull request -

#7003

As an absolute beginner, this took a while to figure out, and eventually required reading through Cider's source files.

Currently, there must be a build.boot file present - an empty one works - if you want to start a repl through cider with boot.

clojure-emacs/cider#1835
syl20bnr pushed a commit to syl20bnr/spacemacs that referenced this issue Oct 19, 2016
Moved to develop branch, original pull request -

#7003

As an absolute beginner, this took a while to figure out, and eventually required reading through Cider's source files.

Currently, there must be a build.boot file present - an empty one works - if you want to start a repl through cider with boot.

clojure-emacs/cider#1835
george-miller pushed a commit to george-miller/spacemacs that referenced this issue Nov 14, 2016
Moved to develop branch, original pull request -

syl20bnr#7003

As an absolute beginner, this took a while to figure out, and eventually required reading through Cider's source files.

Currently, there must be a build.boot file present - an empty one works - if you want to start a repl through cider with boot.

clojure-emacs/cider#1835
@bbatsov bbatsov closed this as completed Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants