Emacs figwheel-main, why stdin in the minibuffer?

clojurescript

#1

I’m just starting out trying to use Clojurescript. I finally got Emacs up and working with Cider and figwheel-main. Only took 2 days, I’ll call that a win. I’m doing this on Windows 10, which probably doesn’t help.

Anyway, after I run cider-jack-in-cljs, it creates a cider-repl buffer, opens my project in the browser, and a few seconds later outputs

Compile Exception: c
ClojureScript 1.10.238
cljs.user=>

There is a “Stdin:” prompt in the minibuffer. Anything I type there gets sent to the repl. Typing anything at the repl prompt gets ignored. The problem is that my minibuffer is now taken by the “Stdin:” prompt so if I try to do anything else (open a file, for example), Emacs complains that the minibuffer is already in use. If I C-g to quit the stdin prompt, my project no longer responds to file changes.

I’m assuming the compile exception probably has something to do with it, but have no idea what “Compile Exception: c” means and don’t know why it would hijack the minibuffer.

How do I go about resolving this?

Thanks,
Rich


#2

What version of Cider are you using? I’m on Cider 0.21.0. Whenever I’m running M-x cider-jack-in-cljs, I get a prompt that says: [Select ClojureScript REPL type] to which I write figwheel-main, after that I get another prompt that asks asks [Select figwheel-main build...], to which I enter dev.

Maybe you’re skipping some of these steps?


#4

I’m using Cider 0.21.0. It does ask me for the REPL type and build, which I put as figwheel-main and dev. I noticed today that when it does this, Cider doesn’t think it’s connected so I don’t get any of the Cider benefits.

I may end up abandoning this path. Just to see, I tried using shadow-cljs instead and it worked out of the box. Took me maybe 20 minutes to do what took 2 days with the other tools. It also connected to VSCode easily and has code completion, etc, which Emacs isn’t giving me.I’d rather use Emacs, but it may not be an option.


#5

If you go in the Message buffer, do you see any errors?


#6

Are you using the latest version of Leiningen? I seem to remember having this issue on Ubuntu and that updating to the latest version fixed it. I think the version you get from Ubuntu apt is out of date – I replaced it with the latest version from the Leiningen website (v2.9.1) and that fixed this issue for me.


#7

It’s good to hear I’m not crazy and somebody else has seen this. :slight_smile: I’m using version 2.9.1 of lein, but maybe something’s not right with it. I’ll try uninstalling it (not sure how to do that, yet) and see if that helps. I’m on Windows, so it may be a platform thing and the fix hasn’t made it into the Windows version.


#8

Damn - sorry, misremembered the issue. Lein solved a different problem I had :slight_smile: The solution to this issue for me was to make sure figwheel-sidecar and cider/piggieback and devtools were the latest versions. I changed the dev dependencies in project.clj to these:

[figwheel-sidecar “0.5.18”]
[cider/piggieback “0.4.1-SNAPSHOT”]
[binaryage/devtools “0.9.10”]


#9

OK, awesome. I’ll try that when I get home tonight.

On a similar note, is there something in Clojure to let you know what the current version of stuff is? Or to add the current version as a dependency for you? For example, with Node you can do “npm install foo” and it will put the current version of foo that it knows about in your config file. Is there a way to do that with the Clojure tools? Having to keep track of specific versions of all the different pieces is a bit tedious.


#10

In the past I’ve used a leiningen plugin to do this – try searching for ‘lein ancient’


#11

I’ll look into ‘lein ancient’. I’m giving up on figwheel at this point. I updated my versions and still see the same behavior. I got everything working with shadow, so I’m going to stick with that. The code completion is a little slow, but at least I can go back to using Emacs and start to break my VSCode habit. :slight_smile: