Fork me on GitHub
Christopher Genovese04:01:51

@thheller I just wanted to circle back on that weird problem I was having a couple weeks back with the odd changes in repl state because after quite a bit of detective work I've tracked down the cause. It turns out that, without my being aware of it, the clj-refactor bindings in emacs were inserting require cljs libspecs in the ns form whenever I hit / with an "new" namespace. Unfortunately, it put those in the :require-macros section rather than the :require section as it should (presumably because it was first). There were a couple of these, and when I removed them the problem went away. When I put them back, the problem returned. I don't understand why that would produce the problems I saw, but the causality seems pretty clear. Thanks again for all your help; I very much appreciate it!

👍 1

I’m starting my app by launching a repl clj -M:shadow-cljs clj-repl then running (shadow/watch :app). I like having that repl there. What is the best way to go about adding functions to this namespace? Can I somehow provide my own namespace and just require the functions that shadow.user does and add my own?


I’ve tried adding :nrepl {:init-ns phrasing.user} to my shadow-cljs.edn and tried adding {:repl-init-ns phrasing.user} to :builds :app :devtools


Also tried :repl {:init-ns phrasing.user} as well


that is not configurable but you are free to just use clj directly


or just (require 'phrasing.user) (in-ns 'phrasing.user)


most people use nrepl though which does support this


I tried that with the following clojure tools alias:

  {:extra-deps {nrepl/nrepl {:mvn/version "0.9.0"}}
   :main-opts ["-m" "nrepl.cmdline"
which loads in the user namesapce. I tried lein repl :connect and that seems to have worked! So thank you!! Do you happen to know why the version isn’t working?


it would work just fine, it just isn't supported because nobody has asked for this before


most people use an editor connected REPL and most editors use nrepl for this, so that is the default that has the most features


ahhh when it connects it prints user> as the prompt. After the first command it prints my designated namespace


that only costed me 3 hours 😂


thanks so much for the help!