Skip to content

Commit 5036392

Browse files
committed
feat: specify default connection params
1 parent 1367b25 commit 5036392

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cider.el

+10-3
Original file line numberDiff line numberDiff line change
@@ -1390,15 +1390,22 @@ server buffer, in which case a new session for that server is created."
13901390
(plist-put :session-name ses-name)
13911391
(plist-put :repl-type 'cljs)))))
13921392

1393+
(defvar-local cider-connect-default-params nil
1394+
"Default plist of params to pass to `cider-connect'.
1395+
Recognized keys are :host, :port and :project-dir.")
1396+
13931397
;;;###autoload
13941398
(defun cider-connect-clj (&optional params)
13951399
"Initialize a Clojure connection to an nREPL server.
1396-
PARAMS is a plist optionally containing :host, :port and :project-dir. On
1397-
prefix argument, prompt for all the parameters."
1400+
PARAMS is a plist optionally containing :host, :port and :project-dir.
1401+
If nil, use the default parameters in `cider-connect-default-params'.
1402+
When called interactively with a prefix argument, prompt for all the
1403+
parameters."
13981404
(interactive "P")
13991405
(cider-nrepl-connect
14001406
(thread-first
1401-
params
1407+
;; Make sure to copy the list, as the following steps will mutate it
1408+
(or params (copy-sequence cider-connect-default-params))
14021409
(cider--update-project-dir)
14031410
(cider--update-host-port)
14041411
(cider--check-existing-session)

0 commit comments

Comments
 (0)