clojure-nl

Companies working with Clojure in The Netherlands: https://docs.google.com/spreadsheets/d/1NzOqY1v-OReB1IquUgHuT3Kh8K8jhPdlwBM6ds7id6Y/edit?usp=sharing
kwrooijen 2020-08-24T07:16:09.001900Z

Morning 👋

thomas 2020-08-24T09:37:58.002100Z

mogge

Mno 2020-08-24T11:26:37.002300Z

Mornon'

Mno 2020-08-24T11:52:55.003500Z

Btw my emacs (prelude) keeps freezing on me for some reason, is this a very common issue? I haven’t found a way to fix it, or exactly what’s triggering it.

Mno 2020-08-24T11:53:43.004Z

If I get frustrated enough I’ll ask around en the #emacs channel. 😅

kwrooijen 2020-08-24T12:06:35.004500Z

I used to have that with Spacemacs / Doom. Then I switched to my own configuration and haven't had that issue since

kwrooijen 2020-08-24T12:06:41.004700Z

No idea what caused it

yannvahalewyn 2020-08-24T13:35:28.005100Z

@kevin.van.rooijen Just switched from my own config to Doom. Why did you switch back?

kwrooijen 2020-08-24T13:37:34.005700Z

Doom was really slow in my experience, and froze every now and then. I also didn't like the whole commandline thing

kwrooijen 2020-08-24T13:38:33.006600Z

With use-package, Straight.el, and commander, it's pretty easy to set something up. But on the other hand I've used Emacs for a long time

kwrooijen 2020-08-24T13:41:08.006900Z

I also just like having full control over Emacs

borkdude 2020-08-24T13:48:21.007500Z

The only time I have emacs hell freezing over with prelude is when visiting a server with dired in tramp mode. Not all the time, but sometimes.

borkdude 2020-08-24T13:49:04.008400Z

The VSCode ssh plugin is so devil-ish nice, all your (linter) plugins will work on the remote machine as if you're working locally. I wish we had that for emacs

borkdude 2020-08-25T18:23:09.025100Z

I'm getting: > Error while checking syntax automatically: (wrong-number-of-arguments (1 . 1) 2)

Mno 2020-08-24T14:07:56.009300Z

Dang well then hopefully it’s just because my machine is over 10 years old and it’ll fix itself if I free up some ram

tvaughan 2020-08-24T15:12:07.009400Z

I use tramp to access a linux container that contains all of my devtools. Except for a few oddities everything works fairly seamlessly

borkdude 2020-08-24T15:13:27.009600Z

I had to hack my zsh scripts because it doesn't understand its prompt or something

borkdude 2020-08-24T15:13:32.009800Z

But even then it was glitchy

borkdude 2020-08-24T15:13:46.010Z

Also clj-kondo doesn't work over tramp

tvaughan 2020-08-24T15:16:12.010200Z

I use clj-kondo inside a linux container

tvaughan 2020-08-24T15:16:24.010400Z

How does it not work?

tvaughan 2020-08-24T15:16:47.010600Z

One of the oddities is that the running container needs to be named "localhost" otherwise cider gets very confused

borkdude 2020-08-24T15:17:42.010800Z

@tvaughan where does clj-kondo run, locally or in the container, when editing a file?

tvaughan 2020-08-24T15:18:04.011Z

Runs in the container

borkdude 2020-08-24T15:18:20.011200Z

but your emacs runs on your local computer?

tvaughan 2020-08-24T15:24:40.011500Z

Correct

tvaughan 2020-08-24T15:26:05.011700Z

For example, you could clone this https://gitlab.com/tvaughan/kibit-runner, run make shell, open /opt/kibit-runner inside the running container (I use https://github.com/masasam/emacs-counsel-tramp), and then run cider-jack-in

tvaughan 2020-08-24T15:26:56.012300Z

From there just make sure to use tramp to open the clojure source code, don't open locally on your laptop

tvaughan 2020-08-24T15:27:29.012500Z

e.g. from an open tramp dired buffer

yannvahalewyn 2020-08-24T15:52:00.013Z

https://downloadmoreram.com/

1
borkdude 2020-08-24T15:52:37.013200Z

yes, kibit runs as part of your JVM process, but clj-kondo does not. So once more, just to make sure: does the clj-kondo process run in your container, did you explicitly install it there?

borkdude 2020-08-24T15:55:58.013400Z

Just want to make sure we're talking about the same thing

tvaughan 2020-08-24T16:00:32.013600Z

clj-kondo runs in the container. The project contains a deps.edn which includes clj-kondo. Dependencies are downloaded as needed (and stored in a persistent volume for use on subsequent runs). I can run clj-kondo via make kondo (probably should change that to make clj-kondo) or flycheck-clj-kondo, again both inside the running container with emacs running on my laptop

borkdude 2020-08-24T16:48:24.013800Z

@tvaughan I'm interested in your setup, because that's exactly the part that didn't work for me. How does your emacs run locally, but flycheck-clj-kondo isn't?

borkdude 2020-08-24T17:03:05.014Z

e.g. how do you connect your local emacs / flycheck to kibit-runner? flycheck has to connect to your docker container via ssh somehow?

borkdude 2020-08-24T17:16:56.014200Z

I guess in the kibit-runner example it works via cider-nrepl probably. How do you do it for clj-kondo?

tvaughan 2020-08-24T17:44:06.014400Z

I use counsel-tramp to connect emacs on my laptop (macOS) to the running container (also running on my laptop). Don't use ssh

borkdude 2020-08-24T17:47:51.015200Z

ok, that's fine, you can find files that way, but how does the flycheck integration work?

tvaughan 2020-08-24T17:47:59.015400Z

For some reason emacs does't see the clj-kondo executable (not on my laptop, not in a running container over tramp, nowhere) so flycheck-clj-kondo isn't working right now. I just upgraded to emacs 27 so maybe I broke something, dunno know

tvaughan 2020-08-24T17:48:23.015600Z

There's nothing to do to get it to work. Provide the executable can be found 😞

borkdude 2020-08-24T17:48:47.015800Z

By default in tramp mode flycheck is disabled

borkdude 2020-08-24T17:49:12.016Z

And flycheck-clj-kondo will execute your local clj-kondo executable. So I still don't understand what you are doing

borkdude 2020-08-24T17:50:18.016200Z

This does work, but clj-kondo will only see your local buffer via stdin, not your config files on the other machine

borkdude 2020-08-24T17:50:30.016400Z

So I'm wondering all the time if you didn't just see that

borkdude 2020-08-24T17:50:37.016600Z

or if you are in fact doing something else

borkdude 2020-08-24T17:51:33.016800Z

Made an issue for it: https://github.com/borkdude/clj-kondo/issues/969

tvaughan 2020-08-24T17:55:35.017200Z

> And flycheck-clj-kondo will execute your local clj-kondo executable. If the buffer was opened over tramp then the clj-kondo executable in the running container should be used. The same way running cider-jack-in or evaluating expressions in the buffer are run/evaluated in the running container

borkdude 2020-08-24T17:56:48.017400Z

> If the buffer was opened over tramp then the clj-kondo executable in the running container should be used. Should be, as in, that would be the correct implementation, or "that's what it's like now"?

borkdude 2020-08-24T17:57:37.017700Z

cider works over a (networked) REPL, of course that's evaluated in whatever you are connected to

tvaughan 2020-08-24T17:57:46.017900Z

That's how I understand tramp to work

borkdude 2020-08-24T17:57:54.018100Z

clj-kondo isn't tied to your REPL

tvaughan 2020-08-24T17:58:22.018300Z

I use cider over the same connection to the running container. counsel-tramp simply uses docker exec

borkdude 2020-08-24T17:58:29.018500Z

Well, if that were the case, I would be very happy

tvaughan 2020-08-24T17:58:36.018700Z

I understand clj-kondo isn't tied to a repl

borkdude 2020-08-24T17:59:07.019Z

Maybe for Docker it's different. My use case is actually running it on another "real" machine.

tvaughan 2020-08-24T17:59:45.019700Z

tramp should work the same regardless, over ssh or docker exec

borkdude 2020-08-24T18:00:31.020Z

So I open a file /ssh:borkdude@10.15.0.1/~/dev/foobar/src/foobar.clj and then edit. Flycheck by default disables all linters. I enable flycheck-mode. Clj-kondo is executed, but it's my local one, linting only what flycheck gives it via stdin

borkdude 2020-08-24T18:00:49.020200Z

ok, let me try

tvaughan 2020-08-24T18:01:18.020400Z

Except clj-kondo should be installed "on the remote machine"

tvaughan 2020-08-24T18:03:42.020700Z

The goal in my case is that everyone should be running the same version of clj-kondo, everything is tested and deployed using this version, and one change is required to upgrade everywhere

borkdude 2020-08-24T18:09:56.020900Z

You can easily see with flycheck-compile and then clj-kondo-clj that it doesn't do what you expect.

borkdude 2020-08-24T18:10:10.021100Z

-*- mode: compilation; default-directory: "/ssh:borkdude@eetvoorjeleven.nu:/home/borkdude/test/" -*-
Compilation started at Mon Aug 24 20:09:27

/Users/borkdude/Dropbox/bin/clj-kondo --lint - --lang clj --cache < /ssh\:borkdude\@eetvoorjeleven.nu\:/home/borkdude/test/foo.clj
/bin/sh: 2: cannot open /ssh:borkdude@eetvoorjeleven.nu:/home/borkdude/test/foo.clj: No such file

Compilation exited abnormally with code 2 at Mon Aug 24 20:09:29

borkdude 2020-08-24T18:10:34.021300Z

As you can see it starts my local clj-kondo in /Users/borkdude/Dropbox/bin/clj-kondo while linting a file over ssh

borkdude 2020-08-24T18:21:58.021600Z

So what I wish it would do is invoke clj-kondo on the remote machine and return the output back to the local emacs

borkdude 2020-08-24T18:22:08.021800Z

But that's not the case right now

tvaughan 2020-08-24T18:25:28.022Z

I think something like (setq flycheck-executable-find #'tramp-handle-executable-find) is needed, https://github.com/flycheck/flycheck/blob/master/flycheck.el#L489 Although it didn't "just work" for me

borkdude 2020-08-24T18:27:00.022400Z

aha.

funcall: Symbol’s function definition is void: tramp-handle-executable-find

tvaughan 2020-08-24T18:27:30.022600Z

I did require tramp though :thinking_face:

borkdude 2020-08-24T18:30:02.022800Z

same

tvaughan 2020-08-24T18:37:47.023Z

I think that function is no longer provided. I'll have to look-up the newer alternative

tvaughan 2020-08-24T22:43:05.023200Z

This works for me:

(defun tvaughan/executable-find (command)
  (executable-find command t))
(setq flycheck-executable-find #'tvaughan/executable-find)

tvaughan 2020-08-24T22:46:42.023400Z

clj-kondo is not installed on my laptop. clj-kondo was installed inside the running container, e.g. npm install --global clj-kondo

tvaughan 2020-08-24T22:48:11.023800Z

Unfortunately I'm getting other errors:

Suspicious state from syntax checker clj-kondo-clj: Flycheck checker clj-kondo-clj returned non-zero exit code 127, but its output contained no errors: 
Try installing a more recent version of clj-kondo-clj, and please open a bug report if the issue persists in the latest release.  Thanks!
Error while checking syntax automatically: (error "Process flycheck-clj-kondo-clj not running")

tvaughan 2020-08-24T22:49:02.024Z

I'm not familiar with this error message. I installed the latest clj-kondo using npm. I'm not sure what the problem is

tvaughan 2020-08-24T23:48:08.024200Z

clj-kondo runs just fine on the command-line, fyi

tvaughan 2020-08-24T23:49:33.024400Z

Also, which is required by executable-find. which is not installed by default in some default container images, like Fedora 32