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
?
Do you mean cider-eval-sexp-up-to-point
(C-c C-v C-o)?
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 ?
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.
makes sense. thank you!
defun
in CIDER simply means a top-level form.
It doesn’t necessarily have to be a definition of any kind.
See also https://docs.cider.mx/cider/1.1/usage/code_evaluation.html
The defun up to point is interesting. I assume you’ll have to close all open brackets in order for it to evaluate, @bozhidar? (Yes, planning to steal this one too. 😃 )
Yep, the command appends the missing parens prior to sending this out to be evaluated.
I finally needed to implement the classic stack exercise of balancing parentheses for a practical purpose. 😄
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.
> 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.
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.