lang/clojure: fix repl handler #1714

This commit is contained in:
Henrik Lissner 2019-10-08 17:38:31 -04:00
parent bb71f591f8
commit 9857b3d481
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 21 additions and 4 deletions

View file

@ -13,10 +13,26 @@ at point."
;;; Commands
;;;###autoload
(defun +clojure/open-repl (&optional arg)
"Open a Cider REPL and return the buffer."
(defun +clojure/open-repl (&optional arg type)
"Open a Cider REPL for clojure and return the buffer."
(interactive "P")
(process-buffer (cider-jack-in arg)))
;; TODO Better error handling
(let ((type (or type 'clj)))
(if-let (buffer (cider-current-repl type))
(pop-to-buffer buffer)
(let ((process (cider-jack-in-clj arg)))
(message "Starting CIDER server for the first time...")
(while (and (process-live-p process)
(not (cider-current-repl type)))
(sit-for 1))
(message "Starting CIDER server for the first time...done")
(pop-to-buffer (cider-current-repl type))))))
;;;###autoload
(defun +clojure/open-cljs-repl (&optional arg)
"Open a Cider REPL for clojurescript and return the buffer."
(interactive "P")
(+clojure/open-repl arg 'cljs))
;;;###autoload
(defun +clojure/cider-switch-to-repl-buffer-and-switch-ns ()