Fork me on GitHub
#cider
<
2021-05-31
>
ag06:05:39

what's the best way of clearing nrepl buffer without having to re-connect/re-start the REPL?

dpsutton06:05:04

the repl buffer or the server buffer?

dpsutton06:05:45

if the nrepl server buffer i think comint-clear-buffer. if the repl buffer cider-repl-clear-buffer

ag06:05:29

perfect. comint-clear-buffer is the one I was looking for

Nom Nom Mousse10:05:27

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?

Nom Nom Mousse10:05:10

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

magra09:06:40

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.

Nom Nom Mousse09:06:19

I did not try to change the handlers, but rather some backend code for data processing.

bozhidar10:05:08

Perhaps your REPL is not in the same ns as the original definition that you're trying to change?

Nom Nom Mousse11:05:08

I've tried (require my-ns) and then (in-ns my-ns). I might have gotten some errors in the REPL. Will check.

Nom Nom Mousse11:05:54

It seems like cider-jack-in starts a new nrepl-server at . I expected it to connect to localhost:7000 where my process is running.

bozhidar11:05:17

You need cider-connect to connect to a running nREPL server.

Nom Nom Mousse11:05:47

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 🙂

bozhidar12:05:39

Probably you didn't put it in the right sector there, as it seems it's not detected at all.

bozhidar12:05:31

If you just add it as a regular dep that won't be enough, as the middleware won't be activated.

Nom Nom Mousse12:05:19

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"]}}}

bozhidar12:05:26

I think you need to put :repl is a top-level profile (like :user). Maybe :dev will work as well, I don't remember.

bozhidar12:05:26

I'm surprised you're not getting some warning about cider-nrepl missing as well.

bozhidar12:05:58

Most likely you don't need lein-nrepl - it was a transitional plugin for users of old Lein releases.

Nom Nom Mousse12:05:14

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.