Fork me on GitHub
#cider
<
2021-07-20
>
jasmin09:07:52

Hello there, I installed a fresh version of linux on my laptop and I can't seem to make cider-jack-in work. It claims The lein executable isn't on your 'exec-path' even though it exists in /usr/bin/ which is listed in the exec-path variable. I've tried googling for the last 2-3 hours but found nothing to remedy this.

jasmin09:07:42

Can someone help me? 🙂

Christopher Miles12:07:15

Double-check and make sure the script is executable, you may have to do that by hand. sudo chmod +x /usr/bin/lein

jasmin12:07:36

Thank you for replying!

ls -l /usr/bin | grep lein
 -rwxr-xr-x 1 root root        4500 Dec 26  2019 lein

dpsutton13:07:10

Can you run lein repl from a terminal?

jasmin13:07:23

Yes, and I can connect to that repl with the cider-connect command and giving it the port number

dpsutton13:07:58

Open up an eterm buffer for emacs and try running it there

jasmin13:07:16

with M-x shell and running lein repl there gives me sh: lein: command not found

jasmin13:07:31

is that what I was supposed to do?

dpsutton13:07:30

that's the issue. emacs cannot see it

dpsutton13:07:51

there's a var called exec-path which has a path for emacs to search for executables

👍 2
dpsutton13:07:15

https://github.com/purcell/exec-path-from-shell and this lovely library can help with lots of that

jasmin13:07:17

that's true, exec-path lists /usr/bin/

jasmin13:07:26

and lein is there

jasmin13:07:19

it seems that I already use that library. I got it from the clojure for the brave and true book's customization files

dpsutton13:07:14

i'm not sure what steps to take then

jasmin14:07:49

thank you for your time 🙂

dpsutton14:07:22

you are welcome. not sure why you can't see it in eshell but whatever is preventing that is also preventing cider from running it. that problem is basically emacs cannot find or cannot run your executable

jasmin14:07:30

there's was something I did yesterday evening, but then I went to sleep and in the morning I couldn't replicate it, and I'm struggling the whole day.

dpsutton14:07:20

that's really frustrating. i'm sorry to hear that

jasmin14:07:38

thank you for your empathy 🙂

jasmin11:07:09

Fixed it finally! Since I installed emacs 27.2 through flatpak it didn't exist as a runnable command in my terminal. So when I started it through the app menu, it ran in a different environment (don't know which). So the fix was to delete that emacs, and install the newest possible (26.3) through my software manager and everything worked smoothly

jasmin11:07:05

echo $PATH in emacs was showing a different value than echo $PATH in my terminal

jasmin12:07:38

Additional things that could bring more info to the table: clojure version 1.10.3.855 lein version 2.9.1 on Java 11.0.11 OpenJDK 64-Bit Server VM cider version 1.1.1 emacs version 27.2 I've also copied the whole .emacs.d folder from my previous installation to the new one (I have a feeling this might be the culprit)

Quentin Le Guennec12:07:46

Is there a way in cider to treat a macro as defn like cursive does?

dpsutton13:07:34

For indentation?

Quentin Le Guennec13:07:55

@dpsutton also for avoiding highlighting things like symbols as flycheck errors

dpsutton13:07:12

Ah. So the error checking is most likely clj-kondo and or lsp. But for indentation clojure mode allows you to set indentations. Also you can use meta data to achieve the same purpose

borkdude13:07:11

@quentin.leguennec1 for ignoring clj-kondo warnings you can use #_:clj-kondo/ignore before the form.

Quentin Le Guennec13:07:48

Yeah exactly that's clj-kondo

Quentin Le Guennec13:07:34

Is there any way to ignore errors on particular forms? Like all (custom-defn ..) forms?

dpsutton13:07:09

you can configure clj-kondo to understand the effect of the macro

borkdude13:07:40

{:lint-as {foo.custom-defn clojure.core/defn}}

dpsutton13:07:53

here's a lovely project with some advanced configuration for a few popular libraries: https://github.com/clj-kondo/config/tree/master/resources/clj-kondo.exports/clj-kondo

dpsutton13:07:17

(I didn't know that you could write functions to parse the forms at runtime and seem to return an annotated ast)

dpsutton13:07:51

or perhaps it is macroexpanding

borkdude13:07:12

it's similar to macro-expansion, but a bit different since you're not working with s-expressions directly but a richer format (rewrite-clj nodes)

ericdallo15:07:15

if using lsp, there is a code action resolve macro assimilar to cursive, which add that clj-kondo config for you.

🎉 4
🤯 4