Fork me on GitHub
Sam Stowers05:12:57

Hey! Beginner here with a possibly dumb question. Trying to get clj-kondo going in emacs, but flycheck says the executable isn't found. Have already checked that clj-kondo is present in the emacs path etc - any thoughts on how I might get it working? Here's what M-x flycheck-verify-setup says:

Syntax checkers for buffer core.clj in clojure-mode:

    - may enable: Automatically disabled!
    - predicate:  nil
    - executable: Not found

    - may enable: Automatically disabled!
    - predicate:  t
    - executable: Not found

Flycheck Mode is disabled.  Use C-u M-x flycheck-disable-checker to
enable disabled checkers.


Flycheck version: 31
Emacs version:    28.0.50
System:           x86_64-pc-linux-gnu
Window system:    x

Sam Stowers05:12:25

Tried this, didn't work unfortunately. Just says the checker doesn't exist, or no selected checker

Sam Stowers05:12:47

Or "no syntax checkers disabled in this buffer"

Sam Stowers05:12:34

Interestingly, if I M-x flycheck-disable-checker on clj-kondo-clj, it then shows up in the C-u M-x command, but I still can't enable it from there.

Sam Stowers05:12:21

My apologies if I'm missing something obvious - I'm learning both Emacs and Clojure at the moment


i noticed you mentioned that clj-kondo is in the emacs path. would you mind elaborating on that point? i am not sure i understood it.


may be you were alluding to the somewhat common issue that occurs when emacs is started not from a terminal but from some kind of launcher or other means that doesn't happen to have an appropriate value for PATH.

Sam Stowers06:12:37

The installation docs mentioned an issue that could happen if the $PATH in Emacs was different from the $PATH in a regular terminal. But I checked and the paths seemed identical


thanks for the clarfication. so you did the M-x shell thing followed by echo $PATH i guess are you able to invoke clj-kondo via the sort-of-terminal buffer associated with invoking M-x shell?


so i'm revisting when i had what seemed like a similar issue before: borkdude mentioned that doing M-x flycheck-compile might be useful -- i think it may give more detailed output.


oh, i see "Flycheck Mode is disabled" in your initial output. have you done M-x global-flycheck-mode and/or is there a (global-flycheck-mode) somewhere in your emacs initialization setup?


i guess so as flycheck-verify-setup might otherwise not show up

Sam Stowers07:12:17

I haven't yet. Will try that after a good night's sleep lol. Thanks for your assistance


hope you rest well!


This is the error you’ll see if you’re using flycheck over TRAMP,, FYI

Sam Stowers21:12:03

@U0P7ZBZCK Thanks for the reply, but I'm not working on a remote host, and I don't think I'm using TRAMP.

Sam Stowers21:12:32

I guess I could try using M-x flycheck-set-checker-executable, but I'm not sure how to find the relevant executables

Sam Stowers21:12:58

flycheck-default-executable-find doesn't seem to be exposed to M-x


re: finding the appropriate executable -- for clj-kondo it should just be the full path to the clj-kondo binary. if you want to try out flycheck-default-executable-find, the following may work: * M-: * (flycheck-default-executable-find "clj-kondo") * RET then proceed through the interaction

Sam Stowers01:12:31

Tried calling executable-find, it says there's a Lisp error.

Sam Stowers01:12:57

Update: solved

Sam Stowers21:12:54

Thanks @U04V15CAJ, but my echo $PATH output is identical when run in a regular terminal and run in M-x shell, so I don't think this is my issue. Unless there are other environmental variables that could be affecting this


So when you type clj-kondo in the shell it works?


Is the path correct if you M-x getenv -> "PATH"?

Sam Stowers01:12:30, actually, seems to be missing node - which could be why it's not finding clj-kondo since I installed it with Node. That's interesting, I had assumed M-x echo $PATH would show the Emacs path

Sam Stowers01:12:57

I'll try installing the tool @U04V15CAJ recommended, will see if that fixes the problem


have you considered installing clj-kondo some other way?

Sam Stowers01:12:59

@UG1C3AD5Z If this doesn't work will try that

👍 3
Sam Stowers01:12:31

It's working! Thanks for the assistance @UG1C3AD5Z @U04V15CAJ @UFAP0C8KU 🙂

Sam Stowers01:12:25

Turns out I had exec-path-from-shell already installed as part of the emacs starter template I was using, but it lacked a necessary line in init.el




so perhaps for the installed-via-node pathway, exec-path-from-shell is important

👍 3

thanks for sharing the solution! fwiw, i also use some linux and i don't install from node, nor do i use exec-path-from-shell, so i was finding it quite curious.