Fork me on GitHub
#cider
<
2017-05-29
>
bozhidar07:05:09

Hah, that’s a surprise. Perhaps, I don’t really remember what I was thinking bad then. 🙂

stardiviner09:05:15

When I cider-jack-in outside of project, it success.

stardiviner09:05:38

I guess this is because clj-refactor Maybe.

benedek15:05:04

when you cider-jack-in you don’t need anything cider or clj-refactor related in your ~/.lein/profiles.clj

oskarkv18:05:44

What must I do to get #break to work? If I place a #break and eval with cider-eval-defun-at-point it doesn't break when I call the function.

oskarkv18:05:38

(defn testfn [] #break (+ 1 2)) then (testfn)

oskarkv18:05:29

Now all of a sudden it works. I swear it didn't work before. 😛

dpsutton18:05:06

oh well. as long as its working now 🙂

richiardiandrea20:05:44

@dpsutton quickly and untested thoroughly:

(defun cider--eval-bindings (bindings)
  "Sends a (def bound-name expr) form to the cider repl for each
binding in bindings."
  (let ((bound-name (pop bindings))
        (init-expr (pop bindings)))
    (when bound-name
      (let ((form (concat "(def " bound-name " " init-expr ")")))
        (set-buffer (cider--get-repl-buffer))
        (insert form)
        (cider-repl-return)
        (cider--eval-bindings bindings)))))

(defun cider-eval-all-let-bindings ()
  (interactive)
  (when (cider--get-repl-buffer)
    (cider--eval-bindings (clojure--read-let-bindings))))

dpsutton20:05:10

looks cool. just off hand, maybe remember the variable names and make an easy way to unintern them?

dpsutton20:05:23

what does (clojure--read-let-bindings) look like?

dpsutton20:05:39

if it's similar to what i did, i just grab that local environment which might be unbounded. not sure what we might clobber

dpsutton20:05:55

also, with throwing your own defs in there, this is something to watch out for:

whatever> (def a 'bob)
#'whatever/a
whatever> a
bob
whatever> (defn a [x] (inc x))
#'whatever/a
whatever> a
#function[whatever/a]

richiardiandrea20:05:52

Yes my version assumes so many things, good points up above for sure

richiardiandrea20:05:37

Anothnr function would unbind all

dpsutton20:05:41

although i might like a defnversion more

dpsutton20:05:02

i think that's why i like the idea of killing it so you can enter it wherever you like

dpsutton20:05:34

but make a (defn investigate-cider-env [] (let [bindings ....] body))

richiardiandrea20:05:32

Btw the read function is in clojure-mode

richiardiandrea20:05:25

cider-invnstigate-bindings maybe?

richiardiandrea20:05:04

Or cider-repl-def-bindings

dpsutton20:05:14

oh ok. this doesn't seem to be what i was thinking

dpsutton20:05:28

my version was run during the debugging session and would capture the local variables during debugging

dpsutton20:05:41

this included forms from function parameters and let bindings

dpsutton20:05:55

this clojure mode style seems to try to parse things?

dpsutton20:05:03

(<-- 
  code  "#dbg
(defn func [x y z]
  (let [a 1
        b 2]
    (let [c..."
  column  0
  coor  (3 2 2)
  debug-value  "16"
  file  "c:/Projects/pomegranate/src/main/clojure/cemerick/whatever.c..."
  id  "6"
  input-type  (dict ...)
  key  "d0e9418e-65ac-41ad-9263-2c3e2aa8e681"
  line  4
  locals  (("x" "1")
 ("y" "2")
 ("z" "3")
 ("a" "1")
 ("b" "2")
 ("c" "3")
 ("d" "4"))
  original-id  "74"
  prompt  nil
  session  "81f41c44-4cdd-4cd3-a027-5ccaeb53e6cc"
  status  ("need-debug-input")
)

dpsutton20:05:33

(defn func [x y z]
  (let [a 1
        b 2]
    (let [c 3
          d 4]
      (+ a b c d x y z))))

dpsutton20:05:46

so we just ask the debugger for the local values

richiardiandrea20:05:52

Yes it looks at the code and sends def in the repl...Maybe a different feature

richiardiandrea20:05:19

Because sometimes you want to use the value of something in a let

dpsutton20:05:45

so it is useful for values known at compile time?

dpsutton20:05:21

the benefit that i'm thinking of is you would captuze x y z and get those values and then you could investigate the form. since a, b, c, d are bound in the let you could just copy that over

richiardiandrea20:05:54

No no, say I have a function, I know the value of the params, I have a let and i want to evaluate against those let bindings at runtime

richiardiandrea20:05:13

So the the body of the let can be tweaked/debugged

dpsutton20:05:41

ah ok. i think i see now