clj-kondo

https://github.com/clj-kondo/clj-kondo
Sam Stowers 2020-12-15T05:21:57.143500Z

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

2020-12-15T05:25:15.143800Z

possibly this might help: https://gist.github.com/sogaiu/5f93faa7cab1d08a1510d281cadb0b81

tvaughan 2020-12-15T09:50:09.153400Z

This is the error you’ll see if you’re using flycheck over TRAMP, https://github.com/flycheck/flycheck/pull/1842, FYI

Sam Stowers 2020-12-15T21:45:03.155500Z

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

Sam Stowers 2020-12-15T21:45:32.155700Z

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

Sam Stowers 2020-12-15T21:45:58.155900Z

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

2020-12-15T22:42:43.156100Z

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 Stowers 2020-12-17T01:10:31.157200Z

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

Sam Stowers 2020-12-17T01:24:57.159100Z

Update: solved

Sam Stowers 2020-12-15T05:27:25.144300Z

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

Sam Stowers 2020-12-15T05:27:47.144500Z

Or "no syntax checkers disabled in this buffer"

Sam Stowers 2020-12-15T05:29:34.144800Z

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 Stowers 2020-12-15T05:33:21.145900Z

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

2020-12-15T05:54:12.146100Z

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.

2020-12-15T05:55:26.146300Z

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 Stowers 2020-12-15T06:15:37.148300Z

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

2020-12-15T06:44:38.148800Z

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?

Sam Stowers 2020-12-15T06:47:10.149300Z

Yes and yes

2020-12-15T07:03:42.149500Z

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.

2020-12-15T07:10:10.149700Z

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?

2020-12-15T07:20:59.150Z

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

Sam Stowers 2020-12-15T07:35:17.150900Z

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

2020-12-15T07:36:22.151100Z

hope you rest well!

borkdude 2020-12-15T20:49:41.153800Z

https://twitter.com/borkdude/status/1338905522846769155Β πŸŽ‰

πŸ™Œ 2
borkdude 2020-12-15T20:50:25.154200Z

@sam694 I think I'm using this tool https://github.com/purcell/exec-path-from-shell

dakra 2020-12-16T10:17:49.156700Z

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

Sam Stowers 2020-12-17T01:15:30.157400Z

...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

Sam Stowers 2020-12-17T01:17:57.157600Z

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

2020-12-17T01:18:28.157800Z

have you considered installing clj-kondo some other way?

Sam Stowers 2020-12-17T01:18:59.158Z

@sogaiu If this doesn't work will try that

πŸ‘ 1
Sam Stowers 2020-12-17T01:23:31.158300Z

It's working! Thanks for the assistance @sogaiu @borkdude @daniel415 πŸ™‚

Sam Stowers 2020-12-17T01:24:25.158500Z

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

2020-12-17T01:24:36.158700Z

congratulations!

2020-12-17T01:24:57.158900Z

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

πŸ‘ 1
2020-12-17T01:30:59.159400Z

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.

Sam Stowers 2020-12-15T21:39:54.154800Z

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

borkdude 2020-12-15T21:42:02.155Z

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

Sam Stowers 2020-12-15T21:42:13.155300Z

Yep