Morning 👋
mogge
Mornon'
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.
If I get frustrated enough I’ll ask around en the #emacs channel. 😅
I used to have that with Spacemacs / Doom. Then I switched to my own configuration and haven't had that issue since
No idea what caused it
@kevin.van.rooijen Just switched from my own config to Doom. Why did you switch back?
Doom was really slow in my experience, and froze every now and then. I also didn't like the whole commandline thing
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
I also just like having full control over Emacs
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.
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
I'm getting: > Error while checking syntax automatically: (wrong-number-of-arguments (1 . 1) 2)
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
I use tramp to access a linux container that contains all of my devtools. Except for a few oddities everything works fairly seamlessly
I had to hack my zsh scripts because it doesn't understand its prompt or something
But even then it was glitchy
Also clj-kondo doesn't work over tramp
I use clj-kondo inside a linux container
How does it not work?
One of the oddities is that the running container needs to be named "localhost" otherwise cider gets very confused
@tvaughan where does clj-kondo run, locally or in the container, when editing a file?
Runs in the container
but your emacs runs on your local computer?
Correct
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
From there just make sure to use tramp to open the clojure source code, don't open locally on your laptop
e.g. from an open tramp dired buffer
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?
Just want to make sure we're talking about the same thing
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
@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?
e.g. how do you connect your local emacs / flycheck to kibit-runner? flycheck has to connect to your docker container via ssh somehow?
I guess in the kibit-runner example it works via cider-nrepl probably. How do you do it for clj-kondo?
I use counsel-tramp to connect emacs on my laptop (macOS) to the running container (also running on my laptop). Don't use ssh
ok, that's fine, you can find files that way, but how does the flycheck integration work?
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
There's nothing to do to get it to work. Provide the executable can be found 😞
By default in tramp mode flycheck is disabled
And flycheck-clj-kondo will execute your local clj-kondo executable. So I still don't understand what you are doing
This does work, but clj-kondo will only see your local buffer via stdin, not your config files on the other machine
So I'm wondering all the time if you didn't just see that
or if you are in fact doing something else
Made an issue for it: https://github.com/borkdude/clj-kondo/issues/969
> 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
> 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"?
cider works over a (networked) REPL, of course that's evaluated in whatever you are connected to
That's how I understand tramp to work
clj-kondo isn't tied to your REPL
I use cider over the same connection to the running container. counsel-tramp simply uses docker exec
Well, if that were the case, I would be very happy
I understand clj-kondo isn't tied to a repl
Maybe for Docker it's different. My use case is actually running it on another "real" machine.
tramp should work the same regardless, over ssh or docker exec
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
ok, let me try
Except clj-kondo should be installed "on the remote machine"
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
You can easily see with flycheck-compile
and then clj-kondo-clj
that it doesn't do what you expect.
-*- 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
As you can see it starts my local clj-kondo in /Users/borkdude/Dropbox/bin/clj-kondo
while linting a file over ssh
So what I wish it would do is invoke clj-kondo on the remote machine and return the output back to the local emacs
But that's not the case right now
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
aha.
funcall: Symbol’s function definition is void: tramp-handle-executable-find
I did require tramp though :thinking_face:
same
I think that function is no longer provided. I'll have to look-up the newer alternative
This works for me:
(defun tvaughan/executable-find (command)
(executable-find command t))
(setq flycheck-executable-find #'tvaughan/executable-find)
clj-kondo is not installed on my laptop. clj-kondo was installed inside the running container, e.g. npm install --global clj-kondo
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")
I'm not familiar with this error message. I installed the latest clj-kondo using npm. I'm not sure what the problem is
clj-kondo runs just fine on the command-line, fyi
Also, which
is required by executable-find. which is not installed by default in some default container images, like Fedora 32