Injecting global debug macros in nrepl with deps.edn

thanks! I didn’t know about user.clj. For convenience I’d like to not have to make a separate dev/user.clj with that in every project but just have it present anytime I run nrepl. I found these instructions: How are `user.clj` files loaded? - #3 by jlesquembre
and made it work by putting in ~/.clojure/deps.edn:

{:aliases ;; Add cross-project aliases here
 {:nrepl {:extra-paths ["/home/user/.clojure"]
          :extra-deps {nrepl/nrepl       {:mvn/version "0.9.0"}
                       cider/cider-nrepl {:mvn/version "0.28.4"}
                       philoskim/debux {:mvn/version "0.8.2"}
                       vvvvalvalval/scope-capture {:mvn/version "0.3.3"}
                       vvvvalvalval/scope-capture-nrepl {:mvn/version "0.3.1"}}
          :main-opts  ["-m" "nrepl.cmdline"
                       "--middleware" "[cider.nrepl/cider-middleware sc.nrepl.middleware/wrap-letsc]"
                       "--interactive"]}}}

then in ~/.clojure/user.clj:

(ns user
  (:require [debux.core :as debux]))

(defmacro dbg
  [arg]
  `(debux/dbg ~arg))

It doesn’t work with just (def dbg debux.core/dbg) as it’s a macro and gives a compiler error about not being able to take the value of a macro. with this clj on startup says:
WARNING: Use of :paths external to the project has been deprecated, please remove: /home/user/.clojure
So it seems making a global user.clj is not encouraged or this isn’t the way to do it.

I’m actually not really worried about getting this working properly anymore cause I switched now to emacs for clojure coding at least, cider is just more mature than what vim has at the moment. And it’s debugger and inspector and stuff takes care of most of the use for those helper macros. I was pleasantly surprised it just took like a day to set up and get somewhat comfortable with doom emacs, it’s closer to vim than any other “vim mode” outside of vim I’ve seen.

Inline def is a nice simple debugging technique for clojure! If you do it a lot def’ing large numbers of local variables maybe you’d like that scope capture library, it’s basically a macro for automating the inline defs, you just put spy at some point and it saves all the local variables at that point, and then can do defsc to def them all, which i bound a key to to make it more convenient