Fork me on GitHub
#cider
<
2020-11-15
>
respatialized18:11:24

is there a way to auto-eval an expression in the REPL on namespace load? basically what I'm trying to do is auto-refer clojure.repl/doc into every namespace, because I pretty much always find myself typing (require clojure.repl [:refer doc]) in every repl session so it's available in the namespace I'm working in. just wondering if there's a general purpose solution to this that could be used to auto-load other code, as well.

bozhidar09:11:55

There's a REPL shortcut to require the REPL utils in some namespace. Type , in the REPL and you'll see what I mean.

practicalli20:11:59

@afoltzm I'd suggest just using cider-docs and evaluate code in the source code buffer rather than evaluate in the REPL buffer directly, which requires more work (changing namespaces, etc). There is also cider-clojuredocs which also provides examples of using the function and cider-apropos that will help you find functions. https://practicalli.github.io/spacemacs/documentation/cider-doc.html If you really have to use the REPL buffer directly and need doc, , will open a REPL menu which has a doc function. If you really want to type (doc function-name), then you can use the the fully qualified name, (clojure.repl/doc function-name) You could require refer doc in every single namespace function of every project you ever work with, which I am sure will raise a few questions about why. I would definatey not recommend this 🙂