summaryrefslogtreecommitdiff
path: root/cider-client.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2018-03-05 13:37:45 +0700
committerBozhidar Batsov <bozhidar@batsov.com>2018-03-05 13:37:45 +0700
commit7d91a6d8c3b0c8b709465b43420d795e27829db4 (patch)
treeb62f3ee7461fb86e8d82d26d34d1215fefcdeec3 /cider-client.el
parent6c16e8af62bf6101dbe3a15919ff8d6ab4f0f977 (diff)
[#2202] Check in advance if a ClojureScript REPL can be created or not
The current logic relies mostly on namespace checks, but it can certainly be improved down the road. The most important thing is that now users are going to get more meaningful errors earlier. Before this we'd first create the second REPL buffer and just get there some obscure errors because the command didn't check at all if piggieback or the target REPL were even available.
Diffstat (limited to 'cider-client.el')
-rw-r--r--cider-client.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/cider-client.el b/cider-client.el
index 3f8d38e1..73e4b6a9 100644
--- a/cider-client.el
+++ b/cider-client.el
@@ -808,6 +808,14 @@ going to clobber *1/2/3)."
t ; tooling
))
+(defun cider-namespace-present-p (ns)
+ "Check whether NS is present or not."
+ (if (thread-first (cider-sync-tooling-eval (format "(if (find-ns '%s) 1 nil)" ns))
+ (nrepl-dict-get "value")
+ (read))
+ t
+ nil))
+
(defalias 'cider-current-repl-buffer #'cider-current-connection
"The current REPL buffer.
Return the REPL buffer given by `cider-current-connection'.")