@@ -671,7 +671,7 @@ The supplied string will be wrapped in a do form if needed."
671
671
form
672
672
(format " (do %s ) " form))))
673
673
674
- (defconst cider-cljs-repl-types
674
+ (defvar cider-cljs-repl-types
675
675
'((" Rhino" " (cemerick.piggieback/cljs-repl (cljs.repl.rhino/repl-env))"
676
676
nil )
677
677
(" Nashorn" " (cemerick.piggieback/cljs-repl (cljs.repl.nashorn/repl-env))"
@@ -693,6 +693,26 @@ REPL to start the ClojureScript REPL and functions to very their requirements.
693
693
694
694
The form should be either a string or a function producing a string." )
695
695
696
+ (defun cider-register-cljs-repl-type (name init-form &optional requirements-fn )
697
+ " Register a new ClojureScript REPL type.
698
+
699
+ Types are defined by the following:
700
+
701
+ - NAME - string identifier that will be used to refer to the REPL typel
702
+ - INIT-FORM - string or function (symbol) producing string
703
+ - REQUIREMENTS-FN - function to check whether the REPL can be started.
704
+ This param is optional.
705
+
706
+ All this function does is modifying `cider-cljs-repl-types' .
707
+ It's intended to be used in your Emacs config."
708
+ (unless (stringp name)
709
+ (user-error " The REPL name must be a string" ))
710
+ (unless (or (stringp init-form) (symbolp init-form))
711
+ (user-error " The init form must be a string or a symbol referring to a function" ))
712
+ (unless (or (null requirements-fn) (symbolp requirements-fn))
713
+ (user-error " The requirements-fn must be a symbol referring to a function" ))
714
+ (add-to-list 'cider-cljs-repl-types (list name init-form requirements-fn)))
715
+
696
716
(defcustom cider-default-cljs-repl nil
697
717
" The default ClojureScript REPL to start.
698
718
0 commit comments