This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-24
Channels
- # announcements (26)
- # babashka (9)
- # beginners (63)
- # calva (2)
- # chlorine-clover (22)
- # cider (2)
- # cljsrn (8)
- # clojure (36)
- # clojure-europe (36)
- # clojure-italy (5)
- # clojure-nl (76)
- # clojure-spec (9)
- # clojure-uk (8)
- # clojurescript (39)
- # conjure (24)
- # cursive (19)
- # data-science (1)
- # datascript (10)
- # datomic (1)
- # emacs (2)
- # events (5)
- # figwheel-main (9)
- # fulcro (21)
- # graalvm (1)
- # helix (5)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (1)
- # leiningen (4)
- # meander (2)
- # off-topic (22)
- # re-frame (16)
- # reitit (3)
- # rewrite-clj (75)
- # rum (1)
- # sci (51)
- # shadow-cljs (110)
- # tools-deps (16)
- # vrac (9)
- # xtdb (23)
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.
I used to have that with Spacemacs / Doom. Then I switched to my own configuration and haven't had that issue since
@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
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 use tramp to access a linux container that contains all of my devtools. Except for a few oddities everything works fairly seamlessly
One of the oddities is that the running container needs to be named "localhost" otherwise cider gets very confused
@U0P7ZBZCK where does clj-kondo run, locally or in the container, when editing a file?
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
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?
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
@U0P7ZBZCK 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
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
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
I use cider over the same connection to the running container. counsel-tramp simply uses docker exec
Maybe for Docker it's different. My use case is actually running it on another "real" machine.
So I open a file /ssh:[email protected]/~/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
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:[email protected]:/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:[email protected]:/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
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
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
Also, which
is required by executable-find. which is not installed by default in some default container images, like Fedora 32
I'm getting: > Error while checking syntax automatically: (wrong-number-of-arguments (1 . 1) 2)