Skip to content

Commit a2c2142

Browse files
yuhan0bbatsov
authored andcommitted
feat: specify default connection params
1 parent 53f0f6e commit a2c2142

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cider.el

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,14 +1443,21 @@ server buffer, in which case a new session for that server is created."
14431443
(plist-put :session-name ses-name)
14441444
(plist-put :repl-type 'cljs)))))
14451445

1446+
(defvar-local cider-connect-default-params nil
1447+
"Default plist of params to pass to `cider-connect'.
1448+
Recognized keys are :host, :port and :project-dir.")
1449+
14461450
;;;###autoload
14471451
(defun cider-connect-clj (&optional params)
14481452
"Initialize a Clojure connection to an nREPL server.
1449-
PARAMS is a plist optionally containing :host, :port and :project-dir. On
1450-
prefix argument, prompt for all the parameters."
1453+
PARAMS is a plist optionally containing :host, :port and :project-dir.
1454+
If nil, use the default parameters in `cider-connect-default-params'.
1455+
When called interactively with a prefix argument, prompt for all the
1456+
parameters."
14511457
(interactive "P")
14521458
(cider-nrepl-connect
1453-
(thread-first params
1459+
;; Make sure to copy the list, as the following steps will mutate it
1460+
(thread-first (or params (copy-sequence cider-connect-default-params))
14541461
(cider--update-project-dir)
14551462
(cider--update-host-port)
14561463
(cider--check-existing-session)

0 commit comments

Comments
 (0)