This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-31
Channels
- # beginners (57)
- # boot (25)
- # cider (86)
- # cljs-dev (6)
- # clojure (137)
- # clojure-russia (7)
- # clojure-spec (10)
- # clojure-turkiye (1)
- # clojure-uk (47)
- # clojurescript (37)
- # cursive (10)
- # datascript (2)
- # datomic (2)
- # dirac (59)
- # emacs (1)
- # hoplon (46)
- # instaparse (122)
- # om (32)
- # om-next (1)
- # onyx (3)
- # pedestal (2)
- # perun (4)
- # protorepl (6)
- # re-frame (15)
- # reagent (60)
- # rum (4)
- # specter (7)
- # sql (3)
- # untangled (3)
- # yada (4)
i'm braising ribs tonight. but i can look at it tomorrow. I'll look at what's going on and see what's up
i don't know of a good way to introspect into the out middleware to see why it thinks 7 is hte id
but i think cider can put "previous" input before the current stuff, which seems to be what's happening here
if i were you you could open an issue and PR in cider-nrepl and hopefully malabarba and some others with experience can chime in
there are already two issues for it, though. and issuing a PR without it being ready to go (there’s a checklist) would be against the guidelines. I’m mostly hoping that someone sees it here, or shows interest in the issues I commented on. But, it’s also the holidays, so people are busy. No worries though, I’m setting this as a challenge to myself.
I fear what may be happening here is that the nrepl server itself isn’t correctly id-ing these things
that's one thing i don't like about the PR open source model. I like collaboration over code rather than pull requests in from the dark. I wish there was a good way to collaborate and talk about code for a single feature, rather than several different people just tossing up features
though, from a maintainer’s point of view, I can see why they don’t want a bunch of half-baked code queued up for them to fix
anyway, if you come up with something, feel free to submit a work-in-progress PR to my branch 🙂
okay, so when cider connects to nrepl, with my configuration, it immediately issues seven requests, with id’s 1-7
okay, it’s not configuration dependent - “out-subscribe” is always the 7th thing done on connect https://github.com/clojure-emacs/cider/blob/a68fd4a22bbd75f5dcdc993eddb289ae5d8e096e/cider.el#L779
(defn subscribe-session
"Add msg to `tracked-sessions-map`."
[{:keys [session] :as msg}]
(when-let [session (:id (meta session))]
(swap! tracked-sessions-map assoc session
(select-key msg [:transport :session :id]))
{:out-subscribe session}))
I have a thing that I think is working, but isn't the cleanest. But my cleanup attempt doesn't work. When I'm back on a wifi connection I'll push, if you wouldn't mind taking a look?
ok. so i did a little playing around and breaking things. It looks like its putting the id of 7 in the map of current connections
so i'm storing the "msg" which i think are really just importatn for transport and session
(-->
ns "user"
op "eval"
session "fce73b9c-6402-4f8b-b599-ce4797672838"
code "(.println *out* \"Hi\")
"
file "*cider-repl fizzbuzz*"
line 43
column 7
id "23"
)
(<--
id "23"
out "Hi
"
session "fce73b9c-6402-4f8b-b599-ce4797672838"
)
(-->
ns "user"
op "eval"
session "fce73b9c-6402-4f8b-b599-ce4797672838"
code "(.println (java.lang.System/out) \"Hi\")
"
file "*cider-repl fizzbuzz*"
line 46
column 7
id "42"
)
(<--
id "7"
out "Hi"
session "fce73b9c-6402-4f8b-b599-ce4797672838"
)
would be nice if when we got a request and it went through all of the layers, as it came back out it was set as a response to request id
My new solution redirects System/out to *out*
after it's rebound to avoid nrepl not handling it
and it would be totally hacky if cider knew to reorder things unless it was for the registering out step
and it would be gross to change that less than sign to a function that returns (if (= id cider-setup-out-id)....)
it works as it is now, but I’d like to abstract out-stream
and err-stream
into a single function
to break it, you can comment (out-stream)
and (err-stream)
on these two lines, and uncomment the calls to print-stream
. https://github.com/bhagany/cider-nrepl/blob/repl-err/src/cider/nrepl/middleware/out.clj#L132-L133
Guys, just thanks! very good job!
you've done the most tiring part of any OSS contribution 🙂
it would be awesome to just dump this conversations in a wiki page 😄
I’ll take your word for it. From my point of view, it’s been quite refreshing to work things out with others like this
can cider load a lein project into an existing repl?
@dpsutton okay, I got it. I’m still not sure why it needed this, but I added a bit of indirection and now print-stream
works
I have defined my own pattern matching macro called mm. Is there a way to tell emacs to indent "mm" in the same awy as "case"? The answer is yes, unfortunately, I don't know what's the right layer to provide this information.
@qqq here you go, I hope it solves! http://jbm.io/2013/11/custom-indentation-in-clojure-mode/
@richiardiandrea : that solved it; thanks!