Fork me on GitHub
#clojurescript
<
2020-06-23
>
dgonsalves2215:06:09

having a hard time getting the text from an element to be used in its on-click. and example of what I have tried.

[:span {:on-click #(js/alert (.. % text))} "foo"]
can anyone help me out?

jjttjj15:06:25

you need

#(js/alert (.-target.textContent %))

kaaninho17:06:06

Hello, I have a question regarding connecting to a figwheel-main repl from Emacs. My setup is similar to this one: https://figwheel.org/docs/create_a_build.html . It works and all, but i want to be able to connect to it via Emacs via cider-connect-cljs. How can i find out the right port to connect to?

bhauman17:06:41

@kaaninho is there a reason you want to use cider-connect-cljs?

bhauman17:06:13

and not cider-jack-in-cljs?

kaaninho17:06:44

Well, I start the app on a terminal and want to connect to that, rather to have it in Emacs.

bhauman17:06:01

yeah that’s a bit of a harder setup

kaaninho17:06:05

(cider-jack-in-cljs works btw)

bhauman17:06:40

cider-connect needs to connect to a nREPL server

bhauman17:06:07

so you would have to start an nREPL server with piggieback middleware

bhauman17:06:29

figwheel.main doesn’t do this automatically for you

kaaninho17:06:08

Oh okay, I see. I will look into that. Thank you, that helped. I thought that I maybe oversaw something trivial.

dpsutton17:06:26

one thing to do, cider-jack-in-cljs and the repl buffer will print out at the top the command used to start the repl. you can then kill the repl and start a process from the terminal with that exact command

kaaninho17:06:40

Ok. But how can I then connect from Emacs to that terminal process?

dpsutton17:06:08

cider-connect-cljs

dpsutton17:06:19

make sure you add the -A:fig

dpsutton17:06:32

/usr/local/bin/clojure -A:fig -Sdeps '{:deps {nrepl {:mvn/version "0.7.0"} cider/piggieback {:mvn/version "0.4.2"} cider/cider-nrepl {:mvn/version "0.25.0-alpha1"}}}' -m nrepl.cmdline --middleware '["cider.nrepl/cider-middleware", "cider.piggieback/wrap-cljs-repl"]'

dpsutton17:06:46

from the command line and then cider-connect-cljs choose figwheel-main, the build and off yougo

bhauman17:06:02

Thats a really good pointer

dpsutton17:06:20

yeah. its in the messages buffer but i like it prominent there

dpsutton17:06:33

i think i had a patch laying around somewhere where i just generated the command and put it in the clipboard

dpsutton17:06:46

save the jvm startup time which you just immediately kill

dpsutton17:06:06

m-x cider-copy-startup-command or something

dpsutton17:06:34

that doesn't exist. but i should dig it up and submit it

kaaninho17:06:11

Ah okay, I will try that out tomorrow. Thank you, @dpsutton

bhauman17:06:06

it seems like one can just put it in deps.edn

bhauman17:06:25

but you have to change it when you update your cider version

l0st3d18:06:58

There isn't a cider-copy-startup-command but there is an option to let you edit the command before the jack in process starts it. That'll let you copy the command from the minibuffer. (setq cider-edit-jack-in-command 't)

dpsutton18:06:23

yeah agreed. don't need to set the edit defvar. just jack in with a prefix and you get to edit it. jack in with double prefix and you can edit things like the project directory and others

dpsutton18:06:31

that might need a docstring update to indicate it

dpsutton18:06:54

i think that's what i usually do. jack in with prefix to edit, copy from minibuffer, then C-g out of the jack in process

kaaninho07:06:59

This works like a charm, thank you. 🙂 @dpsutton

kaaninho07:06:18

Ah, one thing isnt working tho...: if i close the connection in Emacs and try to reconnect, it says that "A build with id ==ID== is already running" . Is this supposed to be like that?

dpsutton17:06:31

@kaaninho ^

dpsutton17:06:12

also, if you're using bruce's template, remove rebel readline. i think it and emacs clash a bit

ai21298319:06:30

Hello guys. I'm seeing a weird bug - using keywords with imported namespace (like ::i/this-works) works fine. Using namespaced maps (like #::i{:this-is-broken true}) fails on compilation with error like No namespace: my-app.imported-namespace found . Any help is very welcome 🙂

bhauman19:06:05

@ai212983 can you provide a minimal example?

ai21298319:06:53

@bhauman Trying to, this thing is very elusive. I have a project with this problem, but once I am trying to reduce, problem disappears. Rolling back to previous change - still no problem where it was 10 minutes ago.

ai21298320:06:38

Seems to be related to build cache. Error disappears after cleaning up resources/public/js. Still have no reproducible setup though.

ai21298319:06:10

As we're talking of examples - any way to submit a bug? Can't create a ticket at Atlassian, got a minimal example https://github.com/ai212983/cljs-source-map-bug

ai21298319:06:06

Talked to David about it, but still have no response after providing minimal example.

dpsutton19:06:18

make a post on https://ask.clojure.org/ and it can be promoted to jira

ai21298319:06:20

@dpsutton Oh, shiny, thanks!

sova23:06:20

Hi! I keep getting this strange error

main.js:1670 An error occurred when loading jpc.rolo.client.js
env.evalLoad @ main.js:1670
(anonymous) @ main.js:1882
main.js:1671 Error: Invalid character: @ found while reading symbol.

sova23:06:57

just reverted a bunch of code hoping it would vanish, but it is still there ;x

sova23:06:05

maybe someone can point me in the right direction pardon my red

noisesmith23:06:12

looks like you had something with a name like [email protected] or [email protected] in a call to a four arg function(?)

sova23:06:50

Oh my gosh, I had to view-source. the server loads data into a html var, it's loading data-mggs="[email protected]"

sova23:06:55

hahah I was going crazy!

sova23:06:07

clojurescript land not involved

noisesmith23:06:22

sounds like you need pr-str instead of str somewhere

sova23:06:34

okay, i gotta find it... thank you

sova23:06:53

luckily i didn't undo THAT much effort xD

sova23:06:41

smashing

sova23:06:42

thank you