Fork me on GitHub
#cider
<
2020-07-06
>
xconconx02:07:46

I'm having trouble with M-x cider-jack-in when I try to start a new REPL I get this feedback: The lein executable isn't on your 'exec-path The only problem is that i download lein to /usr/bin and when I describe exec-path Its value is: ("/home/sfernandez/.local/bin/" "/app/bin/" "/usr/bin/" "/app/libexec/emacs/26.3/x86_64-pc-linux-gnu/") So, I'm not sure if that's the problem... In scratch I did (print cider-lein-command) and it's value is: "lein" "lein" That is "lein" printed twice? Even if I execute $ lein repl in terminal and then try to connect to it that works fine, but I get this warning: WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it! Should I just always use cider-connect ? I've been stuck on trying to get jack in to work for a while Thanks all

dpsutton02:07:16

I always use cider jack in. If you cider-connect you need to ensure that ciders middleware are set up

dpsutton02:07:41

Can you execute “which lein” from a terminal and then do the same from an eshell buffer

xconconx02:07:24

@dpsutton which lein from terminal gives: /usr/bin/lein which lein from eshell buffer gives: which: no lein in (/home/sfernandez/.local/bin:/app/bin:/usr/bin) that seems problematic?

dpsutton02:07:37

Yeah. Seems like it should be seeing it. Which OS?

dpsutton02:07:14

What about “/usr/bin/lein repl” from eshell

dpsutton02:07:26

My guess is user and permissions are incorrect?

dpsutton02:07:40

How did you install lein. I wouldn’t expect it to end up there

xconconx03:07:27

Pop!OS 20.04 LTS x8664 “/usr/bin/lein repl” from eshell -> just gives a command not found? i could have installed it incorrectly i'm kind of a noob, I did : wget and then a : sudo mv lein /usr/bin from root then i changed directory to /usr/bin and chmod a+x lein and I ran the script it seems to have worked fine? it did install and download the self-install package, i just followed instructions from: https://leiningen.org/ in Install section

dpsutton03:07:03

have you restarted emacs since installing it?

xconconx03:07:04

uhh like closing it and reopening 🙂 lol?

xconconx03:07:14

does that count as restarting ?

dpsutton03:07:54

I don't know what closing it means. If you ensure that the emacs process is killed and restarted. gets complicated since some people use emacsclient

dpsutton03:07:35

what are the user and group for ls -l /usr/bin/lein

xconconx03:07:01

pretty sure i've restarted it and ls -l /usr/bin/lein is "-rwxrwxr-x 1 sfernandez sfernandez 13413 Jul 5 20:50 /usr/bin/lein"

xconconx03:07:29

tbh I don't really know the difference between user and group though

dpsutton03:07:45

no worries. groups are just groups that users can belong to

dpsutton03:07:05

but nothing out of the ordinary there. i was suspecting maybe it got moved and set root as its user

xconconx03:07:10

yeah, this is sad

xconconx03:07:22

i don't get why emacs isn't seeing it from eshell ...

xconconx03:07:16

thanks for your help @dpsutton btw

dpsutton03:07:21

from eshell what do you get from just ls /user/bin

dpsutton03:07:24

(of course!)

xconconx03:07:21

whole bunch of stuff with ls /usr/bin i tried ls /usr/bin | grep "lein" and got nothing as expected

dpsutton03:07:31

well at least its consistent

xconconx03:07:02

@dpsutton tbh that's pretty good at least hahaaa

dpsutton03:07:34

maybe try putting it somewhere else on your path? I don't understand how it wouldn't be visible

dpsutton03:07:49

i have a ~/bin that i put stuff in

dpsutton03:07:02

and lein is in there

xconconx03:07:40

ok ill try that and see if it helps

xconconx03:07:04

ok im making some modifications im going mad though

xconconx03:07:18

im gonna restart after doing some sudo updating and upgrading i dont even know

xconconx03:07:53

mad same error

dpsutton03:07:31

same error when putting the lein script elsewhere on your path?

xconconx03:07:52

oh god bless a new error i think i know how to fix this one

xconconx03:07:15

@dpsutton genius move i copied script to $HOME/.local/bin and that did the trick

dpsutton03:07:06

did it illuminate why the original placement wasn't working or its working as you expect from the new location?

xconconx03:07:52

yeah now im just googling this part but the error was

error in process sentinel: Could not start nREPL server: /home/sfernandez/.local/bin/lein: line 255: type: java: not found
Leiningen couldn't find 'java' executable, which is required.
Please either set JAVA_CMD or put java (>=1.6) in your $PATH (/home/sfernandez/.local/bin:/app/bin:/usr/bin).

dpsutton03:07:05

ha. that makes a lot of sense

xconconx03:07:52

@dpsutton i really just ran a java --version saw some output and was on my way earlier very sad

xconconx04:07:06

@dpsutton Did you know that if you launch the GUI version of emacs from favorites it doesn't get any information from your $PATH, but if you launch it from terminal everything works lmao, sigh...

practicalli-johnny12:07:17

@sfernandez0201 if you update your path in your dotfiles then any GUI application will require a logout of the desktop (or restart the operating system) if run from favorites or some other type of application launcher. If you update the path in dotfiles then you need to restart a terminal or use source .dotfile-name to read in the new path setting. This is standard on Unix systems (Linux, MacOSX). I also configur .profile to read the .bashrc file, so that apps run from favourites or an app launcher also used the settings in that file.

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi 

👍 3
xconconx15:07:46

I updated $PATH in .zshrc and did run source afterwards. I restarted and still had the same problem, when I launch emacs from favorites, I still have a different $PATH than if I launch it from terminal. I didn't try adding your suggestion to .zshrc though. I will try that. Thanks!

tianshu14:07:54

Is it possible to specify the port for leiningen plugin cider/cider-nrepl . I'm trying to use docker for development, so I want a fixed port number to expose in Dockerfile.

iarenaza18:07:02

If I understood you right, and you are using Leiningen to start your project REPL, then this is what we add to our project.clj file when using Docker: https://github.com/magnetcoop/pubsub/blob/master/project.clj#L25-L26

tianshu03:07:56

how you start your program, with lein repl?

iarenaza16:07:43

Yes, lein repl :headless in our case.

dpsutton14:07:43

how are you starting your project? You should be able to specify the port you want for nrepl

nick18:07:11

Is it possible to send a function or a region to repl and paste the result right after it?

(+ 1 2)
;; trigger-some-magic-cider-func which pastes back into editor:
3
Basically, just trying to avoid manual copying from cider REPL and pasting it back.

Michaël Salihi18:07:40

@nfedyashev Yes you can use cider-eval-defun-to-comment

🙏 3
nick18:07:18

Thank you!

Michaël Salihi18:07:00

You're welcome. :) > It is bound to C-c M-;, <M-return> e ;, M-m m e ;, and many ordinary text

👍 3
practicalli-johnny06:07:27

, e ; in Spacemacs Evil normal mode. There are also pretty print versions of comment functions

nick07:07:47

@U05254DQM what do you mean by pretty print versions of comment functions?

practicalli-johnny08:07:50

These functions pretty print (e.g. print data structures in a more human readable form) as comments in the source code cider-pprint-eval-defun-to-comment cider-pprint-eval-last-sexp-to-comment They are comment versions of the pretty print functions: cider-pprint-eval-defun-at-point cider-pprint-eval-last-sexp I use the eval-last-sexp commands for expressions nested inside others and defun-at-point for the overal expression.

nick08:07:27

It must be pretty handy for big and complex data structures. Thanks for sharing!

practicalli-johnny08:07:14

pprint to comment is useful for maps with lots of keys or nested data structures. Be careful not to use it for huge return values as it doesnt limit itself to 100 results like the other evaluations do (i should figure out if there is an option for this). The cider-inspector is an excellent way of reviewing uncomfortably sized data https://practicalli.github.io/spacemacs/evaluating-clojure/inspect.html

🙏 3