Fork me on GitHub
#cider
<
2021-06-22
>
lepistane10:06:12

hello i can't seem to find the command that i found very interesting in calva. Since calva is built on top of cider i assumed it would be there. Calva has ctrl +alt + enter which in threaded expression does this (look at the image). i haven't been able to find this for cider. Is there a command for this? edit is it C-c C-v z?

tvirolai10:06:41

Do you mean cider-eval-sexp-up-to-point (C-c C-v C-o)?

lepistane10:06:46

yes it seems to be that! let me ask u this. Why do i get same behavior with C-c C-v z cider-eval-defun-up-to-point and command u suggested ?

tvirolai10:06:36

If I'm not mistaken, the latter is more specific, operating only for functions, while the former is more generic and it should evaluate any form up to the point.

lepistane10:06:58

makes sense. thank you!

bozhidar12:06:06

defun in CIDER simply means a top-level form.

bozhidar12:06:25

It doesn’t necessarily have to be a definition of any kind.

👍 3
pez14:06:49

The defun up to point is interesting. I assume you’ll have to close all open brackets in order for it to evaluate, @U051BLM8F? (Yes, planning to steal this one too. 😃 )

bozhidar14:06:11

Yep, the command appends the missing parens prior to sending this out to be evaluated.

bozhidar14:06:41

I finally needed to implement the classic stack exercise of balancing parentheses for a practical purpose. 😄

😁 2
pez14:06:47

For clarity about built from CIDER. That has two aspects to it. One is quite literally built on CIDER/Orchard infrastructure as I explain a bit in this presentation: https://www.youtube.com/watch?v=NIk5hVzA_fY The other is “heavily inspired from” which goes for a lot of the static services, to which the feature in OP, perhaps surprisingly, belongs. (Even if cider-nrepl is used for carrying out the evaluation, grabbing the right things to evaluate is a static thing, for which Calva has its own infrastructure.

pez14:06:21

> I finally needed to implement the classic stack exercise of balancing parentheses for a practical purpose. Thanks. I was just about to ask. 😃 I might go that route too.

pez14:06:38

I have that functionality, as it happens. For the rainbow parens. But I think I might find it hard to tease it out of there. But, then again, maybe not. We’ll see.