Fork me on GitHub
#cider
<
2019-07-16
>
nate_clojurians00:07:38

is there a "insert top-level form into the repl" in cider? like if my cursor is somewhere buried within nested forms and I want to send the entire top-level form to the repl

suskeyhose00:07:02

cider-eval-defun-at-point might get what you want.

dpsutton00:07:54

There’s an equivalent to insert. That command will just evil

dpsutton00:07:07

Let me finish dinner and I’ll show you my tweaks

dpsutton00:07:25

@nate_clojurians do you use use-package?

nate_clojurians00:07:34

I use doom-emacs

nate_clojurians00:07:45

which uses some package declarations that are pretty nice

dpsutton00:07:27

(setq cider-invert-insert-eval-p t)
  (setq cider-switch-to-repl-after-insert-p nil)
  (setq cider-switch-to-repl-on-insert-p nil)

nate_clojurians00:07:48

oh that first one hell yes

nate_clojurians00:07:53

that has annoyed me for a while

dpsutton00:07:19

so there's a a cider-insert-map under C-c C-j

dpsutton00:07:38

which has insert region(r), defun (d), and expression (e)

dpsutton00:07:32

but it puts focus in the repl which is annoying which is the purpose of the 2nd (and 3rd there. there was a refactor so depending on your CIDER version one of the other is correct)

nate_clojurians00:07:38

it's a little tricky under doom since so many functions are remapped, but I believe I've seen those functions

dpsutton00:07:11

oh and this: (setq clojure-toplevel-inside-comment-form t) which lets you work with top level things inside of (comment ,,,) forms

nate_clojurians00:07:53

This variable is obsolete since 0.21.0; use
cider-switch-to-repl-on-insert instead.

nate_clojurians00:07:04

for cider-switch-to-repl-on-insert-p

dpsutton00:07:05

cool. use that one instead

dpsutton00:07:20

yeah. someone mentioned "on" is ambiguous so now its "after"

nate_clojurians00:07:59

oh, it totally is, good call

nate_clojurians00:07:24

love seeing "Experimental" for a config value

dpsutton01:07:02

ah yeah. forgot i put that in there.

dpsutton01:07:15

can't muck with the definition of what is a top level thing without lots of user testing

nate_clojurians01:07:16

it's no big deal

nate_clojurians01:07:26

yeah, I suppose that's the case

ag06:07:16

Hey guys, I’ve been playing with shadow-cljs and CIDER I don’t think it’s working as I wanted. Can someone point me to a minimal, up to date example of node-js build with CIDER instructions please. Documentation is confusing, some sources say you need to npm install source-map-support and ws, shadow-cljs manual says nothing of that sort, trying to jack-in-cljs prompts me with questions multiple times and then says something like

[:no-worker :dev]WARNING: No Clojure project was detected. The
refactor-nrepl middleware was not enabled. (You can mute this
warning by customizing `cljr-suppress-no-project-warning'.)shadow.user> 
I basically want to cider-jack-in and see printed statements in the REPL when app starts and when I update the code i.e: (`:after-load`). I was able to run shadow-cljs watch dev in one terminal window and then node target/app.js in another, but I just want to cider-jack-in and chill.

ag06:07:00

Honestly, I think Clojurescript REPL driven workflow right now is such a mess. I’ve been writing Clojure for 3 years, and I still can’t figure this out easily, how newbies suppose to deal with this shit I have no idea. Like having a bunch of options wasn’t enough: lein, deps, figwheel, figwheel-main, boot, shadow in browser, shadow in node, with webpack, without it, etc. etc.

ag06:07:12

and somehow we’re like “yeah, Clojurescript is awesome, I wish more people used it”. Yeah, I think more people would’ve used it if it wasn’t so damn confusing.

carkh06:07:50

it's hard to get started, but once it's going, i find it even better than with clojure itself (the workflow)

carkh06:07:08

save the file, see the result instantly, no need to fiddle with the repl... and test results pop a system notification while you look at the app

ag06:07:02

okay, I was able to finally jack-in and I see cljs.user> prompt, but when I change the code my :devtools {:after-load server/reload!} which has only one line (println "Code updated...") is nowhere to be seen. It looks like it’s recompiling, but where is it printing this stuff?

carkh06:07:48

that would depend on your setup

carkh06:07:56

maybe in the browser console ?

ag06:07:28

I don’t want browser console. I need simple, vanilla nodejs

ag06:07:13

I’m trying (:require [cljs.nodejs :as node]) and (node/enable-util-print!) and still not working

carkh06:07:33

i can't help with that, no experience at all with node

carkh06:07:42

better ask in clojurescript channel

bozhidar08:07:38

Admittedly our ClojureScript documentation is pretty basic (https://docs.cider.mx/cider/basics/clojurescript.html) and contributions to it would be most welcome.

dpsutton12:07:21

Can you toss out the refactor nrepl dep? There is no project.edn and it sounds like it’s a bit lost

nickstares014:07:31

using shadow-cljs, when I cider-connect to the repl process, I get

WARNING: No Clojure project was detected. The
refactor-nrepl middleware was not enabled. (You can mute this
warning by customizing `cljr-suppress-no-project-warning'.)
In the repl window, and calling cider-switch-to-repl-buffer I get no cljs REPLs in current session

dpsutton14:07:21

the first is saying clj refactor doesn't speak shadow and it won't do anything. For the second, is the cljs repl connected?

nickstares014:07:46

I have a working shadow-cljs repl buffer in emacs that's connected to the shadow-clj watch app repl process

dpsutton14:07:18

put the point in that buffer and then back into the source buffer. should be good after that

nickstares015:07:19

hmm, that did the trick, but now I'm getting No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code. when I eval a sexp

emoarmy15:07:03

I get this when I am running a web app and haven’t connected my browser to the shadow-cljs server, could that be the case for you?

nickstares015:07:21

new error = progress

dpsutton15:07:41

have you connected the browser to the app?

nickstares015:07:07

Aha! That was it. Didn't realize that was part of the process. First time using shadow-cljs 🙂

nickstares015:07:16

thanks @dpsutton @emoarmy