Skip to content

Commit 0b97151

Browse files
committed
feat: specify default connection params
1 parent 12f10a6 commit 0b97151

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
@@ -1502,14 +1502,21 @@ server buffer, in which case a new session for that server is created."
15021502
(plist-put :session-name ses-name)
15031503
(plist-put :repl-type 'cljs)))))
15041504

1505+
(defvar-local cider-connect-default-params nil
1506+
"Default plist of params to pass to `cider-connect'.
1507+
Recognized keys are :host, :port and :project-dir.")
1508+
15051509
;;;###autoload
15061510
(defun cider-connect-clj (&optional params)
15071511
"Initialize a Clojure connection to an nREPL server.
1508-
PARAMS is a plist optionally containing :host, :port and :project-dir. On
1509-
prefix argument, prompt for all the parameters."
1512+
PARAMS is a plist optionally containing :host, :port and :project-dir.
1513+
If nil, use the default parameters in `cider-connect-default-params'.
1514+
When called interactively with a prefix argument, prompt for all the
1515+
parameters."
15101516
(interactive "P")
15111517
(cider-nrepl-connect
1512-
(thread-first params
1518+
;; Make sure to copy the list, as the following steps will mutate it
1519+
(thread-first (or params (copy-sequence cider-connect-default-params))
15131520
(cider--update-project-dir)
15141521
(cider--update-host-port)
15151522
(cider--check-existing-session)

0 commit comments

Comments
 (0)