Skip to content

Commit 51e84e7

Browse files
committed
feat: specify default connection params
1 parent 4f53c0b commit 51e84e7

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

1507+
(defvar-local cider-connect-default-params nil
1508+
"Default plist of params to pass to `cider-connect'.
1509+
Recognized keys are :host, :port and :project-dir.")
1510+
15071511
;;;###autoload
15081512
(defun cider-connect-clj (&optional params)
15091513
"Initialize a Clojure connection to an nREPL server.
1510-
PARAMS is a plist optionally containing :host, :port and :project-dir. On
1511-
prefix argument, prompt for all the parameters."
1514+
PARAMS is a plist optionally containing :host, :port and :project-dir.
1515+
If nil, use the default parameters in `cider-connect-default-params'.
1516+
When called interactively with a prefix argument, prompt for all the
1517+
parameters."
15121518
(interactive "P")
15131519
(cider-nrepl-connect
1514-
(thread-first params
1520+
;; Make sure to copy the list, as the following steps will mutate it
1521+
(thread-first (or params (copy-sequence cider-connect-default-params))
15151522
(cider--update-project-dir)
15161523
(cider--update-host-port)
15171524
(cider--check-existing-session)

0 commit comments

Comments
 (0)