Skip to content

Commit 803c7fc

Browse files
committed
Refactor cider-connect-clj&cljs
1 parent 1adbf16 commit 803c7fc

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

cider.el

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

16031608
(defvar cider-connection-init-commands
16041609
'(cider-jack-in-clj

0 commit comments

Comments
 (0)