[Clojure] Keybinding require Clojure repl utils in current namespace

Although the Clojure repl utils (clojure.repl) are including in the user
namespace in Clojure projects, they are not available in your application
namespace.

The existing CIDER function cider-repl-require-repl-utils adds the Clojure
repl utils into the current namespace, so you can use functions such as doc
and source.

This is often a source of confusion for those new to Clojure / CIDER.
This commit is contained in:
John Stevenson 2019-07-11 15:01:40 +01:00 committed by duianto
parent 85bd5e6df0
commit cd95789170
3 changed files with 4 additions and 0 deletions

View file

@ -1190,6 +1190,8 @@ Other:
- ~SPC m e i~ interrupt the current evaluation (stop long running process) - ~SPC m e i~ interrupt the current evaluation (stop long running process)
(thanks to John Stevenson) (thanks to John Stevenson)
- ~SPC m e v~ to evaluate s-expression at point (=cider-eval-sexp-at-point=) - ~SPC m e v~ to evaluate s-expression at point (=cider-eval-sexp-at-point=)
- ~SPC m s u~ require Clojure utils into current namespace
i.e. functions =doc= =source= (thanks to John Stevenson)
- Fixes: - Fixes:
- Remove `cider.nrepl/cider-middleware` in lein quick start setting - Remove `cider.nrepl/cider-middleware` in lein quick start setting
- Fixed =cider-inspector-prev-page= binding, also add ~p~ as another key - Fixed =cider-inspector-prev-page= binding, also add ~p~ as another key

View file

@ -296,6 +296,7 @@ As this state works the same for all files, the documentation is in global
| ~SPC m s r~ | send and eval region in REPL | | ~SPC m s r~ | send and eval region in REPL |
| ~SPC m s R~ | send and eval region and switch to REPL in =insert state= | | ~SPC m s R~ | send and eval region and switch to REPL in =insert state= |
| ~SPC m s s~ | switch to REPL or jump to last file or last clj buffer from repl (cider-repl) | | ~SPC m s s~ | switch to REPL or jump to last file or last clj buffer from repl (cider-repl) |
| ~SPC m s u~ | require Clojure utils into current namespace - i.e. functions =doc= =source= |
| ~SPC m s x~ | refresh REPL | | ~SPC m s x~ | refresh REPL |
| ~SPC m s X~ | restart REPL | | ~SPC m s X~ | restart REPL |

View file

@ -126,6 +126,7 @@
"ss" (if (eq m 'cider-repl-mode) "ss" (if (eq m 'cider-repl-mode)
'cider-switch-to-last-clojure-buffer 'cider-switch-to-last-clojure-buffer
'cider-switch-to-repl-buffer) 'cider-switch-to-repl-buffer)
"su" 'cider-repl-require-repl-utils
"sx" 'cider-ns-refresh "sx" 'cider-ns-refresh
"sX" 'cider-restart "sX" 'cider-restart