summaryrefslogtreecommitdiff
path: root/cider-repl.el
diff options
context:
space:
mode:
authorVitalie Spinu <spinuvit@gmail.com>2018-06-28 11:27:47 +0200
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2018-06-30 19:24:48 +0200
commit40c1fa0962b4c2285b432cb25263b5edf8c164e2 (patch)
tree91a32de24df9923feb35d297cca60839990c2723 /cider-repl.el
parentaecf9b05f1598bc25a0f1d65c982dde1afad2d9a (diff)
Refactor `cider-switch-to-repl-buffer` and `cider-repl-switch-to-other`
- cider-switch-to-repl-buffer uses cider-current-repl instead of implementing its own lookup - cider-repl-switch-to-other throws a "no other REPL" error if no other REPL exists instead of switching to an arbitrary buffer
Diffstat (limited to 'cider-repl.el')
-rw-r--r--cider-repl.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/cider-repl.el b/cider-repl.el
index 57e72354..eb919799 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -1027,10 +1027,12 @@ text property `cider-old-input'."
"Switch between the Clojure and ClojureScript REPLs for the current project."
(interactive)
;; FIXME: implement cycling as session can hold more than two REPLs
- (if-let* ((this-repl (cider-current-repl))
- (other-repls (seq-remove (lambda (r) (eq r this-repl)) (cider-repls))))
- (switch-to-buffer (car other-repls))
- (message "There's no other REPL for the current project")))
+ (let* ((this-repl (cider-current-repl nil 'ensure))
+ (other-repl (car (seq-remove (lambda (r) (eq r this-repl)) (cider-repls nil t)))))
+ (if other-repl
+ (switch-to-buffer other-repl)
+ (user-error "No other REPL in current session (%s)"
+ (car (sesman-current-session 'CIDER))))))
(defvar cider-repl-clear-buffer-hook)