Skip to content

Commit ada51c5

Browse files
yuhan0bbatsov
authored andcommitted
Refactor cider-connect-clj&cljs
1 parent 89347cc commit ada51c5

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

cider.el

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,22 +1526,27 @@ their supplied or default values."
15261526
(defun cider-connect-clj&cljs (params &optional soft-cljs-start)
15271527
"Initialize a Clojure and ClojureScript connection to an nREPL server.
15281528
PARAMS is a plist optionally containing :host, :port, :project-dir and
1529-
:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). When SOFT-CLJS-START is
1530-
non-nil, don't start if ClojureScript requirements are not met."
1529+
:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc).
1530+
If nil, use the default parameters in `cider-connect-default-params' and
1531+
`cider-connect-default-cljs-params'.
1532+
1533+
When SOFT-CLJS-START is non-nil, don't start if ClojureScript requirements are
1534+
not met.
1535+
1536+
With the prefix argument, prompt for all the parameters regardless of
1537+
their supplied or default values."
15311538
(interactive "P")
1532-
(let* ((params (thread-first params
1533-
(cider--update-project-dir)
1534-
(cider--update-host-port)
1535-
(cider--check-existing-session)
1536-
(cider--update-cljs-type)))
1537-
(clj-params (thread-first params
1538-
copy-sequence
1539-
(map-delete :cljs-repl-type)))
1540-
(clj-repl (cider-connect-clj clj-params)))
1539+
(let* ((clj-repl (cider-connect-clj params))
1540+
(cljs-params
1541+
(thread-first (or params cider-connect-default-cljs-params)
1542+
(copy-sequence)
1543+
(cider--update-cljs-type)
1544+
;; already asked, don't ask on sibling connect
1545+
(plist-put :do-prompt nil))))
15411546
(when (if soft-cljs-start
1542-
(cider--check-cljs (plist-get params :cljs-repl-type) 'no-error)
1547+
(cider--check-cljs (plist-get cljs-params :cljs-repl-type) 'no-error)
15431548
t)
1544-
(cider-connect-sibling-cljs params clj-repl))))
1549+
(cider-connect-sibling-cljs cljs-params clj-repl))))
15451550

15461551
(defvar cider-connection-init-commands
15471552
'(cider-jack-in-clj

0 commit comments

Comments
 (0)