Skip to content

Commit 7889b5f

Browse files
committed
Refactor cider-connect-clj&cljs
1 parent 9ad6b03 commit 7889b5f

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
@@ -1585,22 +1585,27 @@ their supplied or default values."
15851585
(defun cider-connect-clj&cljs (params &optional soft-cljs-start)
15861586
"Initialize a Clojure and ClojureScript connection to an nREPL server.
15871587
PARAMS is a plist optionally containing :host, :port, :project-dir and
1588-
:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). When SOFT-CLJS-START is
1589-
non-nil, don't start if ClojureScript requirements are not met."
1588+
:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc).
1589+
If nil, use the default parameters in `cider-connect-default-params' and
1590+
`cider-connect-default-cljs-params'.
1591+
1592+
When SOFT-CLJS-START is non-nil, don't start if ClojureScript requirements are
1593+
not met.
1594+
1595+
With the prefix argument, prompt for all the parameters regardless of
1596+
their supplied or default values."
15901597
(interactive "P")
1591-
(let* ((params (thread-first params
1592-
(cider--update-project-dir)
1593-
(cider--update-host-port)
1594-
(cider--check-existing-session)
1595-
(cider--update-cljs-type)))
1596-
(clj-params (thread-first params
1597-
copy-sequence
1598-
(map-delete :cljs-repl-type)))
1599-
(clj-repl (cider-connect-clj clj-params)))
1598+
(let* ((clj-repl (cider-connect-clj params))
1599+
(cljs-params
1600+
(thread-first (or params cider-connect-default-cljs-params)
1601+
(copy-sequence)
1602+
(cider--update-cljs-type)
1603+
;; already asked, don't ask on sibling connect
1604+
(plist-put :do-prompt nil))))
16001605
(when (if soft-cljs-start
1601-
(cider--check-cljs (plist-get params :cljs-repl-type) 'no-error)
1606+
(cider--check-cljs (plist-get cljs-params :cljs-repl-type) 'no-error)
16021607
t)
1603-
(cider-connect-sibling-cljs params clj-repl))))
1608+
(cider-connect-sibling-cljs cljs-params clj-repl))))
16041609

16051610
(defvar cider-connection-init-commands
16061611
'(cider-jack-in-clj

0 commit comments

Comments
 (0)