Fork me on GitHub

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


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


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


@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?


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


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


My guess is user and permissions are incorrect?


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


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: in Install section


have you restarted emacs since installing it?


uhh like closing it and reopening 🙂 lol?


does that count as restarting ?


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


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


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"


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


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


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


yeah, this is sad


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


thanks for your help @dpsutton btw


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


(of course!)


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


well at least its consistent


@dpsutton tbh that's pretty good at least hahaaa


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


i have a ~/bin that i put stuff in


and lein is in there


ok ill try that and see if it helps


ok im making some modifications im going mad though


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


mad same error


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


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


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


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


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


ha. that makes a lot of sense


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


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


@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"

👍 3

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!


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.


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:


how you start your program, with lein repl?


Yes, lein repl :headless in our case.


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


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

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

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


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


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.


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


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

🙏 3