calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
bringe 2021-05-11T02:15:09.058300Z

@pez @plexus I had a friend experience a similar thing recently (on Windows) in that some audio program he had installed had edited his hosts file.

Janne Sauvala 2021-05-11T06:18:30.062400Z

Hello 👋:skin-tone-2: when using Calva + the vim extension (vscodevim) and trying to eval some forms, the eval doesn’t include the last ) that is under the caret. This happens when you have normal mode activated. In the insert mode you can move the caret at the end of the last ) so the eval works. I was wondering if you have come up with some Calva (or vscodevim) specific setting which could make the eval to include the last ) when using the normal mode? 🙂

practicalli-john 2021-05-11T07:21:51.062500Z

Sounds like the last expression is being evaluated rather than the top level expression. VSpaceCode will do both types of evaluation commands, so maybe there is a different keybinding / command to use with the vscodevim extension. Or just move to the line after the expression and evaluate

pez 2021-05-11T07:29:25.062700Z

Actually Calva doesn’t really have a concept of last sexpression. It will try to find the “current” form.

practicalli-john 2021-05-11T07:49:28.062900Z

In Calva, evaluate the current form behaves like evaluate last s-expression when the cursor is after a nested expression but still within a top-level expression

practicalli-john 2021-05-11T07:52:55.063200Z

For example, with the cursor on the last closing paren in this expression (- 10 (* 2 3)) , the "evaluate current form" will return 6 using "evaluate top level form" returns 4

practicalli-john 2021-05-11T07:55:42.063400Z

So my suggestion to the original question is to use "Calva: Evaluate top level form". Or move to the next line and use "Calva: evaluate current form" which evaluates the top level form it finds behind the cursor.. shouldnt matter how many empty lines there are.

practicalli-john 2021-05-11T07:58:55.063600Z

So unless a specific nested form should be evaluated, then use "Evaluate top level form"

pez 2021-05-11T08:02:28.063800Z

Calva will evaluate (* 2 3) if the cursor is before it as well (unless there is a previous sexpr on the same line, which will take precedence.

practicalli-john 2021-05-11T08:05:54.064Z

Good to know. I like the simplicity of current and top form evaluation. The Calva approach seems a simpler than the 8 different command available for Cider 🙂

😄 2
Janne Sauvala 2021-05-11T09:06:16.064200Z

Great tip to switch to use “Evaluate top level form” instead, thanks :thumbsup::skin-tone-2:

pez 2021-05-11T09:07:36.064400Z

File a feature request about it, @janne.sauvala. Maybe there is a way we can detect the normal mode.

pez 2021-05-11T09:10:10.064600Z

You can also try configuring a custom command for now. Yesterday I pushed a change that makes it easier to get keyboard shortcuts bound to those. There are quite a few predefined ones,, chords starting with ctrl+alt+space and then things like a-`z` and digits and some more. See https://calva.io/custom-commands/

pez 2021-05-11T09:12:34.064900Z

A shortcut something like this might work:

"calva.customREPLCommandSnippets": [
        {
            "name": "Normal mode eval current form",
            "key": "enter",
            "snippet": "$current-form)"
        }
    ]
And would then be bound to the keyboard shortcut ctrl+alt+space enter

pez 2021-05-11T09:15:46.065300Z

Also try what is evaluated in normal mode if you have the cursor adjacent before the list.

Janne Sauvala 2021-05-11T09:30:04.065500Z

Thanks, Peter. I can try that also 🙂

pez 2021-05-11T11:06:22.071100Z

I tried vscodevim myself now. I had misunderstood the behaviour some, so that custom command won’t cut it. I noticed that having the cursor on the opening bracket or before it evaluated the form though.

practicalli-john 2021-05-11T11:59:35.071300Z

For comparison, in VSpaceCode I use the , e f for the top level form and , e e for last expression, to match the bindings in Spacemacs and SpaceVim

pez 2021-05-11T12:53:08.071500Z

, e e for current expression. 😃

pez 2021-05-11T12:54:16.071700Z

foo
 | bar
| denoting the cursor. bar will be evaluated.

pez 2021-05-11T12:54:49.071900Z

foo | bar
foo will be evaluated

practicalli-john 2021-05-11T13:04:42.072100Z

Really useful to know about the way current expression works, I like it. Thank you.

djptek 2021-05-11T14:18:30.078Z

There is kind of a disclaimer here: https://calva.io/vim/ & I don't think that's all on :calva: as I have issues with :vim: bindings with other languages on Visual Studio Code. So, TBH if I'm feeling Vimmy I've been using https://liquidz.github.io/vim-iced/ lately & I actually have the Vim plugin disabled in VS Code 😕

practicalli-john 2021-05-11T17:21:18.080600Z

I only had to remap Calva Esc key binding to Shift-Esc and all was fine with Calva and VSpaceCode for key bindings. I should add the submitted VSpaceCode key bindings for Calva on the page you mentioned, thank you for the reminder.

borkdude 2021-05-11T09:50:46.067400Z

@pez As a quick workaround for Windows / Oracle 15 issues: people can set JAVA_CMD to override the executable that is being used by tools.deps. It might not be as beginner friendly, but it offers them a way out. You could also hack this yourself: if you detect the executable is this weird Oracle "wrapper?!", then you search for the corresponding "working" java executable and set JAVA_CMD to that (for the Getting Started REPL only I'd say)

pez 2021-05-11T10:10:49.070100Z

Makes sense. Maybe something like where java and if it has Oracle in there, tell the user to update jackInEnv with the path to the non-“wrapped” executable….

pez 2021-05-11T10:12:12.070900Z

This issue seems to hit lein as well, btw: https://github.com/BetterThanTomorrow/calva/issues/1106

mschmele 2021-05-11T13:14:54.074300Z

Hey y’all - I’m trying to load rebl from calva, and no matter what I do I always get

; Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:382).
; cognitect.rebl
I’m using the leiningen instructions on the site, and am using the latest Oracle JDK. I have rebl downloaded, have run the install script, morning and am using the absolute path to the jar file. Has anybody had problems like this before?

borkdude 2021-05-11T13:24:44.074900Z

@mschmele There is an error with passing EDN arguments to latest Oracle JDK's (higher or equal to 15 roughly)

borkdude 2021-05-11T13:25:04.075300Z

see the previous message(s)

borkdude 2021-05-11T13:25:17.075700Z

you're better off using AdoptOpenJDK or a workaround by setting JAVA_CMD

mschmele 2021-05-11T13:27:00.075900Z

Ah gotcha, thanks

mschmele 2021-05-11T13:51:02.076800Z

still doesn’t seem to be working for me even after changing my java version to OpenJDK 11

pez 2021-05-11T14:00:31.077500Z

I haven’t tried REBL lately, maybe something has changed…

pez 2021-05-11T14:00:51.077700Z

Let’s see if we have some REBL users in this channel who can assist.

🙌 1
pez 2021-05-11T16:05:03.080400Z

TIL: Installing the VIM extension means all VS Code windows get it enabled w/o reloading the window. But to disable VIM you’ll need to reload all those windows. In my case 12 of them… Gah!

🙀 1
stianalmaas 2021-05-11T18:44:17.080800Z

😁 Very much in the style of the old joke about how easy it is to quit vim 😜

Leo Ware 2021-05-11T23:04:06.084200Z

dumb question but how to you run the whole file? I don't want to option+enter every function every time

2021-05-11T23:07:50.084700Z

Load Current File and Dependencies

2021-05-11T23:08:10.085200Z

Can right click to do it and select from menu (or on my machine its Ctrl+Alt+C Enter)

👍 2