This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-22
Channels
- # admin-announcements (22)
- # boot (109)
- # cider (119)
- # cljs-dev (19)
- # clojure (181)
- # clojure-berlin (3)
- # clojure-dev (10)
- # clojure-japan (10)
- # clojure-korea (2)
- # clojure-russia (105)
- # clojure-sg (1)
- # clojure-spain (2)
- # clojurescript (53)
- # code-reviews (2)
- # core-async (4)
- # datomic (2)
- # editors (21)
- # instaparse (5)
- # jobs (1)
- # ldnclj (12)
- # off-topic (2)
- # onyx (146)
no problem
so I’m sure I’m still just missing something simple
but I’m trying to just run a really simple Reagent project in my beloved emacs/CIDER environment and when I follow those instructions, after M-x cider-jack-in-clojurescript
I get CompilerException java.lang.ClassNotFoundException: weasel.repl.websocket, compiling:(path/to/ugly/filename.clj)
I’ve come so far but googling for that leads mainly to a Reddit thread where someone is asking about setting up vim-fireplace with Figwheel 😐
I know that the landscape is very much in flux, and I have not been keeping up with it as well as I’d like, so maybe what I’m trying to do still can’t be done
I am on 0.10.0snapshot of CIDER and cider-nrepl
it is
What happens if you start a regular cider-jack-in
, and then evaluate (weasel.repl.websocket/repl-env :ip "127.0.0.1" :port 9001)
at the repl?
` :dependencies [[org.clojure/clojure "1.7.0"] [org.clojure/clojurescript "0.0-3308"] [reagent "0.5.0"] [weasel "0.6.0"] [com.cemerick/piggieback "0.2.1”]]` that’s my deps form from project.clj
aaaand backtick doesn’t work across lines :d’oh:
ClassNotFoundException weasel.repl.websocket java.net.URLClassLoader.findClass (URLClassLoader.java:381)
that was uh
the problem
or at least it returned #weasel.repl.websocket.WebsocketEnv{:ip "127.0.0.1", :port 9001}
Actualy, before I jump to conclusions, evaluate this on the repl, and tell me if it gives you a cljs repl:
(cemerick.piggieback/cljs-repl (weasel.repl.websocket/repl-env :ip "127.0.0.1" :port 9001))
yeah, I’m very much certain that this is a case of me doing something wrong
well, it tried - I got an IOException: No client connected to websocket
and I can’t seem to hit localhost:9001 with a browser
though it did give me a cljs.user>
repl prompt
absolutely
Evaluate the following in Emacs (setq cider-cljs-repl "(do (require 'weasel.repl.websocket) (cemerick.piggieback/cljs-repl (weasel.repl.websocket/repl-env :ip \"127.0.0.1\" :port 9001)))")
okay, nREPL server starting up
so that got further - I get both the CLJ and CLJS REPLs in separate frames
but the cljs REPL still throws the IOException
interestingly, it throws it again if I go find that (repl/connect “<ws://localhost:9001”>) line in core.cljs and C-c C-k
I’d think I need to have a browser loading the page somewhere for the Weasel REPL to work but I can’t figure out where I am either starting a server, or what port to try and hit
that’s, again, probably something I’m doing not quite right
thank you so much for taking the time to help me with this, by the way. I hope that I’m actually helping you test new stuff with my flailing about
"Weasel will block the REPL, waiting for a client to connect."
The lie detector determine that statement …was a lie.
though my dependency is 0.6.0, not 0.7.0
let me see what happens if I change that
<< waiting for client to connect...
okay, I’m much further along and have a better understanding of what I’m doing
Maybe see if you can get it to work manually, by following those steps on a regular clojure repl
Now. IIUC, that repl/connect snippet needs to be part of your clojurescript code, which I think should be compiled and opened in the browse.
oh, I see
I was thinking I needed to be serving up a webpage
yeah, no problem - thanks again so much for your help
Yeah, that's what I thought too, but that cljs snippet needs to be run somehow. And I think you can't run it in the repl if you don't have a repl yet...
right
But these are very bold statements from a very tired person. :-) good night and good luck.
Just as a data point: I never got the weasel+piggieback combination to work. Not once. And not for the lack of trying. I finally gave up: for ClojureScript development I just use figwheel with its reloading, and println for debugging. Perhaps one day…
i echo that basic outcome
figwheel + println has been the only sustainable way i’ve been able to work
The cljs rhino repl worked as advertised for me out of the box. But all I did was start it and play around a bit.
@malabarba: do you perhaps know how i might configure a variant of an emacslisp global-set-key i have to use the C-u prefix variant to run an alternate function?
i’d like to run the first defun here when i C-u C-c r
, and the second when i simply C-c r
:
https://github.com/robert-stuttaford/.emacs.d/blob/master/keybinds.el#L48-L68
@robert-stuttaford yes, you need to define a new command
i tried simply giving it that keybind but it scolded me
You have to write a command that checks forthe prefix, and then calls the appropriate function. And then bind this command to C-c r
found http://ergoemacs.org/emacs/elisp_universal_argument.html. i’m sure i’ll figure it out now, thank you
(defun run-the-test (first)
(interactive "P")
(call-interactively
(if first #'the-first-command
#'the-second-command)))
That "P"
inside interactive
specifies that the first
argument is the prefix argument.
what is the purpose of call-interactively, there?
awesome. works great. thank you, sir!
robert-stuttaford: It mimics the effect of you invoking those commands through a keybind
Like passing them some arguments, and setting the value of some interactive variables
yep: https://github.com/robert-stuttaford/.emacs.d/blob/master/keybinds.el#L48-L59
well alright, I’ve gotten (js/alert “Hi, Mom!”)
to put up an alert via the Weasel cljs repl
and while that’s pretty cool, I cannot seem to make changes to core.cljs and see them show up even by reloading the webpage so
I guess it’s off to figwheel + println for now. Thanks a ton @malabarba for all your assistance, also to @jrychter and @robert-stuttaford for sharing your experience and letting me know that it maybe wasn’t all user error I was running into.
@chris_johnson I'll certainly go into this again when I need to do cljs, then you can be sure we'll make it work our of the box