Fork me on GitHub
#cider
<
2020-07-06
>
sfernandez020102: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

sfernandez020102: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

sfernandez020103: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?

sfernandez020103:07:04

uhh like closing it and reopening 🙂 lol?

sfernandez020103: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

sfernandez020103: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"

sfernandez020103: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

sfernandez020103:07:10

yeah, this is sad

sfernandez020103:07:22

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

sfernandez020103: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!)

sfernandez020103: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

sfernandez020103: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

sfernandez020103:07:40

ok ill try that and see if it helps

sfernandez020103:07:04

ok im making some modifications im going mad though

sfernandez020103:07:18

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

dpsutton03:07:31

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

sfernandez020103:07:52

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

sfernandez020103: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?

sfernandez020103: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

sfernandez020103:07:52

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

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

jr0cket12: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 

sfernandez020115: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!

doglooksgood14: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

doglooksgood03: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

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

admin05518:07:40

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

admin05518:07:00

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

jr0cket06:07:27

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

nfedyashev07:07:47

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

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

nfedyashev08:07:27

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

jr0cket08: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