what's the best way of clearing nrepl buffer without having to re-connect/re-start the REPL?
the repl buffer or the server buffer?
if the nrepl server buffer i think comint-clear-buffer
. if the repl buffer cider-repl-clear-buffer
perfect. comint-clear-buffer
is the one I was looking for
I'm trying to learn repl-driven programming. I've done cider-jack-in
and successfully connected to my running luminus-app (I think). However, when I try to change my running program by overwriting the function in the repl, it does not seem to register the change. Am I doing something wrong?
(I am learning REPL-driven programming because I want to avoid having to reload my webserver for every time I make a change to the app, but instead send the changes to the running program)
Just a guess: When you call a ring-server with a stack of handlers this gets built when you first call it. Changing the handlers afterwards will not change the ring-stack which has already been built. One way to resolve this at dev-time is to use start the ring-server with #'handlers
instead of handlers
so repl changes take effect.
I did not try to change the handlers, but rather some backend code for data processing.
Perhaps your REPL is not in the same ns as the original definition that you're trying to change?
I've tried (require my-ns)
and then (in-ns my-ns)
. I might have gotten some errors in the REPL. Will check.
It seems like cider-jack-in
starts a new nrepl-server
at <nrepl://localhost:59405>
. I expected it to connect to localhost:7000
where my process is running.
You need cider-connect
to connect to a running nREPL server.
https://docs.cider.mx/cider/1.1/basics/up_and_running.html#connect-to-a-running-nrepl-server
I've also tried cider-connect
, but then I get these error messages:
WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it! (More information)
WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 2.5.0 and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.
Despite me having added [refactor-nrepl "2.5.0"]
to my ~/lein/profiles.clj
.
Thanks for the help btw 🙂Probably you didn't put it in the right sector there, as it seems it's not detected at all.
See https://docs.cider.mx/cider/1.1/basics/middleware_setup.html#using-leiningen
If you just add it as a regular dep that won't be enough, as the middleware won't be activated.
This is my entire ~/.lein/profiles.clj
:
{:user
{:plugins [[luminus/lein-template "4.06"]
[lein-midje "3.2.1"]]
:repl {:plugins [[nrepl/lein-nrepl "0.3.2"]
[cider/cider-nrepl "0.25.5"]
[refactor-nrepl "2.5.0"]]}
:dependencies [[com.bhauman/rebel-readline "0.1.4"]
[hashp "0.2.1"]]
:injections [(:require 'hashp.core)]
:aliases {"rebl" ["trampoline" "run" "-m" "rebel-readline.main"]}}}
I think you need to put :repl
is a top-level profile (like :user
). Maybe :dev
will work as well, I don't remember.
I'm surprised you're not getting some warning about cider-nrepl missing as well.
Most likely you don't need lein-nrepl
- it was a transitional plugin for users of old Lein releases.
I tried moving it to the top-level, like :user
, but I get the same error. Might be something with my Doom Emacs Clojure setup. Will investigate.