cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
ag 2021-05-31T06:32:39.067800Z

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

dpsutton 2021-05-31T06:36:04.068Z

the repl buffer or the server buffer?

dpsutton 2021-05-31T06:36:45.068500Z

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

ag 2021-05-31T06:51:29.069Z

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

Nom Nom Mousse 2021-05-31T10:15:27.071200Z

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 Mousse 2021-05-31T10:17:10.072100Z

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

magra 2021-06-01T09:13:40.081700Z

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 Mousse 2021-06-01T09:15:19.081900Z

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

bozhidar 2021-05-31T10:59:08.072600Z

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

Nom Nom Mousse 2021-05-31T11:31:08.073400Z

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 Mousse 2021-05-31T11:34:54.074300Z

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.

bozhidar 2021-05-31T11:39:17.075200Z

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

Nom Nom Mousse 2021-05-31T11:39:47.076Z

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 🙂

bozhidar 2021-05-31T12:03:39.076400Z

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

bozhidar 2021-05-31T12:05:31.077Z

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

Nom Nom Mousse 2021-05-31T12:12:19.077600Z

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

bozhidar 2021-05-31T12:20:26.078700Z

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

bozhidar 2021-05-31T12:21:26.079600Z

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

bozhidar 2021-05-31T12:21:58.080200Z

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

Nom Nom Mousse 2021-05-31T12:37:14.081100Z

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.