Skip to content

Commit a2534bf

Browse files
committed
Convert the ClojureScript repl type to a symbol
That's done for consistency with the rest of the configuration. Typically in Emacs configuration keys are symbols, not strings. The previous arrangement was an oversight of mine.
1 parent 69e6bed commit a2534bf

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

cider.el

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -678,39 +678,39 @@ The supplied string will be wrapped in a do form if needed."
678678
(format "(do %s)" form))))
679679

680680
(defvar cider-cljs-repl-types
681-
'(("Nashorn" "(cemerick.piggieback/cljs-repl (cljs.repl.nashorn/repl-env))"
681+
'((nashorn "(cemerick.piggieback/cljs-repl (cljs.repl.nashorn/repl-env))"
682682
cider-check-nashorn-requirements)
683-
("Figwheel" "(do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/start-figwheel!) (figwheel-sidecar.repl-api/cljs-repl))"
683+
(figwheel "(do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/start-figwheel!) (figwheel-sidecar.repl-api/cljs-repl))"
684684
cider-check-figwheel-requirements)
685-
("Node" "(do (require 'cljs.repl.node) (cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env)))"
685+
(node "(do (require 'cljs.repl.node) (cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env)))"
686686
cider-check-node-requirements)
687-
("Weasel" "(do (require 'weasel.repl.websocket) (cemerick.piggieback/cljs-repl (weasel.repl.websocket/repl-env :ip \"127.0.0.1\" :port 9001)))"
687+
(weasel "(do (require 'weasel.repl.websocket) (cemerick.piggieback/cljs-repl (weasel.repl.websocket/repl-env :ip \"127.0.0.1\" :port 9001)))"
688688
cider-check-weasel-requirements)
689-
("Boot" "(do (require 'adzerk.boot-cljs-repl) (adzerk.boot-cljs-repl/start-repl))"
689+
(boot "(do (require 'adzerk.boot-cljs-repl) (adzerk.boot-cljs-repl/start-repl))"
690690
cider-check-boot-requirements)
691-
("Shadow" cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements)
692-
("Custom" cider-custom-cljs-repl-init-form nil))
691+
(shadow cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements)
692+
(custom cider-custom-cljs-repl-init-form nil))
693693
"A list of supported ClojureScript REPLs.
694694
695695
For each one we have its name, the form we need to evaluate in a Clojure
696696
REPL to start the ClojureScript REPL and functions to very their requirements.
697697
698698
The form should be either a string or a function producing a string.")
699699

700-
(defun cider-register-cljs-repl-type (name init-form &optional requirements-fn)
700+
(defun cider-register-cljs-repl-type (type init-form &optional requirements-fn)
701701
"Register a new ClojureScript REPL type.
702702
703703
Types are defined by the following:
704704
705-
- NAME - string identifier that will be used to refer to the REPL typel
705+
- TYPE - symbol identifier that will be used to refer to the REPL type
706706
- INIT-FORM - string or function (symbol) producing string
707707
- REQUIREMENTS-FN - function to check whether the REPL can be started.
708708
This param is optional.
709709
710710
All this function does is modifying `cider-cljs-repl-types'.
711711
It's intended to be used in your Emacs config."
712-
(unless (stringp name)
713-
(user-error "The REPL name must be a string"))
712+
(unless (symbolp type)
713+
(user-error "The REPL type must be a symbol"))
714714
(unless (or (stringp init-form) (symbolp init-form))
715715
(user-error "The init form must be a string or a symbol referring to a function"))
716716
(unless (or (null requirements-fn) (symbolp requirements-fn))
@@ -724,15 +724,15 @@ This affects commands like `cider-jack-in-clojurescript'. Generally it's
724724
intended to be set via .dir-locals.el for individual projects, as its
725725
relatively unlikely you'd like to use the same type of REPL in each project
726726
you're working on."
727-
:type '(choice (const "Nashorn")
728-
(const "Figwheel")
729-
(const "Node")
730-
(const "Weasel")
731-
(const "Boot")
732-
(const "Shadow")
733-
(const "Custom"))
727+
:type '(choice (const :tag "Nashorn" nashorn)
728+
(const :tag "Figwheel" figwheel)
729+
(const :tag "Node" node)
730+
(const :tag "Weasel" weasel)
731+
(const :tag "Boot" boot)
732+
(const :tag "Shadow" shadow)
733+
(const :tag "Custom" custom))
734734
:group 'cider
735-
:safe #'stringp
735+
:safe #'symbolp
736736
:package-version '(cider . "0.17.0"))
737737

738738
(make-obsolete-variable 'cider-cljs-lein-repl 'cider-default-cljs-repl "0.17")
@@ -742,13 +742,13 @@ you're working on."
742742
(defun cider-select-cljs-repl ()
743743
"Select the ClojureScript REPL to use with `cider-jack-in-clojurescript'."
744744
(let ((repl-types (mapcar #'car cider-cljs-repl-types)))
745-
(completing-read "Select ClojureScript REPL type: " repl-types)))
745+
(intern (completing-read "Select ClojureScript REPL type: " repl-types))))
746746

747747
(defun cider-cljs-repl-form (repl-type)
748748
"Get the cljs REPL form for REPL-TYPE."
749749
(let ((repl-form (cadr (seq-find
750750
(lambda (entry)
751-
(equal (car entry) repl-type))
751+
(eq (car entry) repl-type))
752752
cider-cljs-repl-types))))
753753
;; repl-form can be either a string or a function producing a string
754754
(if (symbolp repl-form)
@@ -759,7 +759,7 @@ you're working on."
759759
"Verify that the requirements for REPL-TYPE are met."
760760
(when-let* ((fun (nth 2 (seq-find
761761
(lambda (entry)
762-
(equal (car entry) repl-type))
762+
(eq (car entry) repl-type))
763763
cider-cljs-repl-types))))
764764
(funcall fun)))
765765

doc/clojurescript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ You can suppress the prompt the REPL to use by setting `cider-default-cljs-repl`
5656
Here's an example that will make Nashorn the default:
5757

5858
```el
59-
(setq cider-default-cljs-repl "Nashorn")
59+
(setq cider-default-cljs-repl 'nashorn)
6060
```
6161

6262
All supported ClojureScript REPLs are stored in
6363
`cider-cljs-repl-types`. If you need to extend it, you should use
6464
`cider-register-cljs-repl-type` in your Emacs configuration.
6565

6666
```el
67-
(cider-register-cljs-repl-type "super-cljs" "(do (...))" optional-requirements-function)
67+
(cider-register-cljs-repl-type 'super-cljs "(do (...))" optional-requirements-function)
6868
```
6969

7070
You can also create a ClojureScript REPL with the command

0 commit comments

Comments
 (0)