Skip to content

Commit 9ec56ce

Browse files
committed
Add a custom ClojureScript REPL type
It simply prompts you the form to use to start a ClojureScript REPL.
1 parent 76a644a commit 9ec56ce

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cider.el

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,17 @@ this is a command, not just a string."
660660
(build (string-remove-prefix ":" (read-from-minibuffer "Select shadow-cljs build: "))))
661661
(format form build build)))
662662

663+
(defun cider-custom-cljs-repl-init-form ()
664+
"Prompt for a form that would start a ClojureScript REPL.
665+
666+
The supplied string will be wrapped in a do form if needed."
667+
(let ((form (read-from-minibuffer "Please, provide a form to start a ClojureScript REPL: ")))
668+
;; TODO: We should probably make this more robust (e.g. by using a regexp or
669+
;; parsing the form).
670+
(if (string-prefix-p "(do" form)
671+
form
672+
(format "(do %s)" form))))
673+
663674
(defconst cider-cljs-repl-types
664675
'(("Rhino" "(cemerick.piggieback/cljs-repl (cljs.repl.rhino/repl-env))"
665676
nil)
@@ -673,7 +684,8 @@ this is a command, not just a string."
673684
cider-check-weasel-requirements)
674685
("Boot" "(do (require 'adzerk.boot-cljs-repl) (adzerk.boot-cljs-repl/start-repl))"
675686
cider-check-boot-requirements)
676-
("Shadow" cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements))
687+
("Shadow" cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements)
688+
("Custom" cider-custom-cljs-repl-init-form nil))
677689
"A list of supported ClojureScript REPLs.
678690
679691
For each one we have its name, the form we need to evaluate in a Clojure

0 commit comments

Comments
 (0)