This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-12
Channels
- # ai (1)
- # announcements (7)
- # babashka (32)
- # beginners (23)
- # biff (9)
- # calva (1)
- # cljs-dev (13)
- # clojure (32)
- # clojure-belgium (1)
- # clojure-chicago (15)
- # clojure-europe (24)
- # clojure-india (3)
- # clojure-nl (3)
- # clojure-norway (55)
- # clojure-uk (4)
- # clojurebridge (1)
- # clojurescript (5)
- # core-async (17)
- # data-science (9)
- # datomic (29)
- # events (3)
- # fulcro (16)
- # graalvm-mobile (4)
- # helix (15)
- # hyperfiddle (74)
- # introduce-yourself (1)
- # jobs (4)
- # kaocha (12)
- # leiningen (27)
- # lsp (16)
- # shadow-cljs (6)
- # spacemacs (20)
- # sql (27)
- # squint (7)
- # tools-deps (29)
- # vim (2)
- # xtdb (10)
Does/can lein repl
write ./.nrepl-port
file?
This seems like it would be easy to find info on but I'm struggling.
It's not creating that file for me by default.
It does't seem to here
wonder what https://codeberg.org/leiningen/leiningen/src/branch/main/src/leiningen/repl.clj#L252 is about
Do you get any nREPL output in your logs? Something like:
nREPL server started on port 34603 on host 127.0.0.1 -
REPL-y 0.5.1, nREPL 1.0.0
Clojure 1.11.1
OpenJDK 64-Bit Server VM 17.0.8+7-jvmci-23.0-b15
Leiningen 2.10.0 on Java 17.0.8.1 OpenJDK 64-Bit Server VM
on my linux box and
Leiningen 2.10.0 on Java 20.0.1 OpenJDK 64-Bit Server VM
on my maclein repl
and lein repl :headless
do not write a ./.nrepl-port
file
which logs do you mean?
the commands do print that to /dev/tty
nREPL server started on port 38097 on host 127.0.0.1 -
I think it might only write that file in a project.
/tmp
❯ mkdir foo
/tmp
❯ cd foo
/tmp/foo
❯ lein repl
nREPL server started on port 58193 on host 127.0.0.1 -
REPL-y 0.5.1, nREPL 1.0.0
Clojure 1.11.1
OpenJDK 64-Bit Server VM 18.0.2.1+1
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=>
zsh: suspended lein repl
/tmp/foo
❯ ls -a
. ..
/tmp/foo
❯ fg
[1] + continued lein repl
Welcome back!
Bye for now!
/tmp/foo
❯ cd ..
/tmp
❯ rmdir foo
/tmp
❯ lein new foo
Generating a project called foo based on the 'default' template.
The default template is intended for library projects, not applications.
To see other templates (app, plugin, etc), try `lein help new`.
/tmp
❯ cd foo
/tmp/foo
❯ ls
CHANGELOG.md README.md project.clj src
LICENSE doc resources test
/tmp/foo
❯ lein repl
nREPL server started on port 58535 on host 127.0.0.1 -
REPL-y 0.5.1, nREPL 1.0.0
Clojure 1.11.1
OpenJDK 64-Bit Server VM 18.0.2.1+1
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
foo.core=>
zsh: suspended lein repl
/tmp/foo
❯ ls -a
. .nrepl-port project.clj
.. CHANGELOG.md resources
.gitignore LICENSE src
.hgignore README.md target
.lein-repl-history doc test
/tmp/foo
Thanks @U0ETXRFEW. It does seem to write it in a project.
@UE21H2HHD++ helped figured out that it writes to ~/.lein/repl-port
otherwise.
I can do what I need now...
Ah, well, that might or might not be what one wants. 😃 But as long as it is deterministic, I guess it’s fine.
I'm writing a shell function called nrepl
for me personally that will start a lein repl
server in a background process in any directory, and then write .nrepl-port
and .nrepl-pid
files.
If they already exist it will just report the port and pid.
So I can just mv ~/.lein/repl-port ./.nrepl-port
if needed after starting the lein repl
server.
Using lein repl
for now because my current projects all use lein
I don't know leiningen very well, but wouldn't it be abnormal to run lein repl
in a dir without a project.clj
?
I can see it being useful. :)
fwiw, I'm trying to get my REPL/nREPL fu solidified and only use REPL servers from various clients from now on. It's not super easy to learn all the right things to do on this but it's important that I figure it all out. I did watch @U04V70XH6’s talk on REPL DD https://www.youtube.com/watch?v=gIoadGfm5T8 but that doesn't instantly make me a expert by any stretch. Also... advice welcome.
Shouldn’t be abnormal? Isn’t that what a lot of Clojure at a glance guides tell you to do?
Running lein repl
outside of a project is fine. If it werent then the task would signal an error (like e.g. running lein uberjar
in an empty folder)