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:
clj-kondo-edn
- may enable: Automatically disabled!
- predicate: nil
- executable: Not found
clj-kondo-clj
- 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
possibly this might help: https://gist.github.com/sogaiu/5f93faa7cab1d08a1510d281cadb0b81
This is the error youβll see if youβre using flycheck over TRAMP, https://github.com/flycheck/flycheck/pull/1842, FYI
@tvaughan Thanks for the reply, but I'm not working on a remote host, and I don't think I'm using TRAMP.
I guess I could try using M-x flycheck-set-checker-executable
, but I'm not sure how to find the relevant executables
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
Tried calling executable-find, it says there's a Lisp error.
Update: solved
Tried this, didn't work unfortunately. Just says the checker doesn't exist, or no selected checker
Or "no syntax checkers disabled in this buffer"
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.
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
.
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
?
Yes and yes
so i'm revisting when i had what seemed like a similar issue before: https://clojurians-log.clojureverse.org/clj-kondo/2019-10-24
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
I haven't yet. Will try that after a good night's sleep lol. Thanks for your assistance
hope you rest well!
https://twitter.com/borkdude/status/1338905522846769155Β π
@sam694 I think I'm using this tool https://github.com/purcell/exec-path-from-shell
Is the path correct if you M-x getenv
-> "PATH"?
...no, 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
I'll try installing the tool @borkdude recommended, will see if that fixes the problem
have you considered installing clj-kondo some other way?
@sogaiu If this doesn't work will try that
It's working! Thanks for the assistance @sogaiu @borkdude @daniel415 π
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
congratulations!
so perhaps for the installed-via-node pathway, exec-path-from-shell
is important
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.
Thanks @borkdude, 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?
Yep