Fork me on GitHub

I came up with a working PoC for injections using NREPL. Is there a more straight-forward way to accomplish this?


The injection in this case is requiring pprint.


The code is easily referenced in a deps.edn alias:

:inject {:extra-deps {waffletower/repl-eval {:local/root "../repl-eval/"}
                      nrepl/nrepl {:mvn/version "0.7.0"}
                      refactor-nrepl/refactor-nrepl {:mvn/version "2.5.0"}
                      cider/cider-nrepl {:mvn/version "0.25.1"}}
         :main-opts ["-m" "repl-eval.nrepl"]}
While I could refactor this to instrument variable middleware and injection forms, is there some hook I am missing here? It was much much easier and cleaner to accomplish REPL initialization with leiningen.


I'm assuming by "injection" here you mean "evaluate some code on nREPL startup", right?

☝️ 1

There's nothing in the existing CLI UI, although it'd be easy to add something like --init or whatever. CIDER itself injects a bit of code via cider-repl-require-repl-utils-code.

🙇 1

Usually when I write a defn form in emacs, the docstring is rendered in a nicer style (italics, in my case). What should I modify if I want to get that when I use macros that replace the defn form, like >defn from guardrails?