Fork me on GitHub

I have new ClojureScript project that runs via the command line and opens up the browser with the ClojureScript app, but doesn't run from Emacs using cider-jack-in-cljs.

error in process filter: Figwheel-main is not available.  Please check 
I created a new project with the Clojure CLI tools and the figwheel-main template (using clj-new). This is the first time with this approach, so I may have missed something.
clj -A:new figwheel-main practicalli/study-group-guide -- --reagent
When I run cider-jack-in-cljs from Emacs, it prompts me for the build tool. I select figwheel-main and then I get the error. The web page does open (assuming because figwheel is not running) Output in message buffer
[nREPL] Starting server via /usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/piggieback {:mvn/version "0.4.1"} refactor-nrepl {:mvn/version "2.5.0-SNAPSHOT"} cider/cider-nrepl {:mvn/version "0.22.0-beta8"}}}' -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware", "cider.piggieback/wrap-cljs-repl"]'...
[nREPL] server started on 40737
[nREPL] Establishing direct connection to localhost:40737 ...
[nREPL] Direct connection to localhost:40737 established
error in process filter: user-error: Figwheel-main is not available. 
I am using the latest version of Cider (updated 12:00 UTC today) and Clojure CLI tools and clj-new Emacs version GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.4) of 2019-06-19 If there is nothing obvious I have missed, I will have a dig around. If I cant get it working, I'll raise a ticket. Thank you.


Basically this only checks if the figwheel.main ns in present.


Perhaps you didn’t start the right profile or something like this?


Will do. It seems to be specific to this project. Other projects that were working, are still working in Emacs / CIDER


It doesnt prompt me for a profile. It dies before that


Its the first time I have created a project with this template, so will also compare all the configurations to the project that works.


I meant the deps.edn profile. It wouldn’t prompt you about this - it just runs whatever the default one is.


I get a second prompt when I run a figwheel-main project created from a Leiningen template (I am still figuring out this whole Clojure CLI tools / deps.edn stuff )


I am sure I will find something simple missing in the difference between the two project configurations.


The only difference I can see is how Leiningen and deps.edn include figwheel-main as a dependency. Leiningen uses :profiles {:dev ,,,} deps.edn uses

:aliases {:fig {:extra-deps
                  {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
                   com.bhauman/figwheel-main {:mvn/version "0.1.9"}}


the dev profile is used by lein by default so its always there. you'll need to ad the fig profile to the cider startup command. The easiest way is to just prefix before jacking in and adding that profile. there's also cider-clojure-cli-global-options that you can set


is there a dir-locals (or what ever its called) approach for this, so I dont forget 🙂


I can google for it if you dont have it to hand


yeah you can set cider-clojure-cli-global-options i nyour dir locals. set that to "-A:fig"


but try it with the prefix to make sure this will fix your issue


Yes, just trying to remember how try it with a prefix in Spacemacs 🙂


Oops, I killed the classpath... I didnt put the fig profile in quotes


Yes, it works....


SPC u C-c M-J gives me the jack-in command line prompt and when I put -A:fig in the right place straight after the /user/local/bin/clojure command, it works (I put it after -Sdeps first and things went bang 🙂 )


[nREPL] Starting server via /usr/local/bin/clojure -A:fig -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/piggieback {:mvn/version "0.4.1"} refactor-nrepl {:mvn/version "2.5.0-SNAPSHOT"} cider/cider-nrepl {:mvn/version "0.22.0-beta8"}}}' -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware", "cider.piggieback/wrap-cljs-repl"]'...
[nREPL] server started on 35247
[nREPL] Establishing direct connection to localhost:35247 ...
[nREPL] Direct connection to localhost:35247 established


I learnt a lot today, thanks @dpsutton and @bozhidar


One question. Has clojure-jack-in-cljs command be around for a while? Like more than 6 months? Spacemacs is still using cider-jack-in-clojurescript which as of the latest CIDER beta release seems no longer available - it tells me to use cider-jack-in-cljs instead. Just wanted to be sure I could safely update the Spacemacs Clojure layer with the new command without breaking anyones older setup 🙂


@jr0cket At least an year. You can safely update it.


A few people complained that the aliases for the jack-in commands were confusing, as they seemed like different jack-in commands, so I’ve decided to trim them all, except the legendary cider-jack-in (which for a while has been an alias for cider-jack-in-clj.


Good work. Less commands is definitely easier 🙂


The setting in .dir-locals.el is not getting picked up by the cider jack in. Does this look correct

((clojure-mode . ((cider-clojure-cli-global-options . "-A:fig"))))
I assume if the above config is correct, then I have probably just told spacemacs not to load .dir-locals files at some point. I can see the fig alias is missing from jack in command in the message in the status buffer. I created the file following this guide


I switched if off and on again... and it worked !!!


Well, I closed all the project files and the layout for that project I had open, then opened the figwheel-main.edn file in another layout and started cider-jack-in-cljs and the alias was picked up in the jack in command from .dir-locals.el


@jr0cket a buffer has to be recreated for the vars to go in effect.


I recall there was also some command to refresh them, but I don’t remember what was its name.


revert-buffer I believe.




@dpsutton It’s a function, not a command, but yeah - I was thinking of it.


I just found the awesome cider browse ns feature... thank you for that! I use evil-mode... any suggestions for overriding those bindings in vanilla terminal emacs? in particular, would like to be able to jump to definition with the 's' key which evil has reserved.


try cider-apropos 🙂


ok... will take a look.


cider-apropos looks good... however, I definitely like the straightforward list of cider-browse-ns-all... ideally I would like to just move the pointer up and down that list and see the declaration in the other window like cider-browse-ns-find-at-point, ideally without leaving the list, but that probably doesn't exist quite like that.


I guess it's really just about dropping into a ns or project and being able to see what it's about on a functional level and peruse it.


which there may be better approaches to than I'm thinking of.


I don't really navigate that much around a project namespace, as most of my namespaces are relatively small (certainly compared to my previous Java projects). I jump around a lot using Evil mode and avvy and on larger namespaces I may use code folding. Here is a selection of what I currently do


"jump to first unbalanced parens" that is crazy to me 🙂


@jr0cket recently I stumbled upon the same block with the figwheel-main alias. Others will probably be blocked by it too since, as you stated, C-u C-c M-J borks if you insert -R:fig or -A:fig at the end, so even the solution has this little nitpick. Where would be the right place to explain this detail @bozhidar?


it needs to be a well-formed clj incantation. is that really CIDER documentation required? You're editing the raw clj form


@anantpaatra I'll be adding what I have learnt to my (one day I will finish it) book on Spacemacs

😄 1
💪 1

I feel it ends up being a little counter intuitive because CIDER injects a lot of things in the string and you are given the minibuffer with point at the end of it. I for once had tried the solution but still had to ask around to actually get that it wouldn't support it.


I enjoyed breaking my classpath, but then I am not on a deadline or just starting with ClojureScript. I am happy to do a pull request to the already excellent

🎉 1

it used to present a kinda custom editor. I chose to change it to the raw command so it was clear where things can go. Its just a clj or lein invocation


happy to have better docs all the time though 🙂


how do I move the cider repl window so it is on the right side with a horizontal split rather than the default wide-and-short vertical split on the bottom?


I only know for Spacemacs Evil normal mode, which is SPC w l or SPC w L


I think you can check out window dedication. It's been driving me crazy as of late and I am going to look into that. I get the issue where I connect to cider and it replaced my current window split, rather then move to another one.


@U70QFSCG2 As mentioned, window purpose is probably what you want if you have a need to control window placement based on buffer type I never use the REPL buffer myself and Spacemacs doesn't open that buffer in a window by default. Evaluating in the source code buffer is much more effective for me.


i'm using evil, and my normal window moving commands don't seem to affect the repl window