branch: elpa/cider
commit a2c21427e396f151392442f2e14a73b08c3dab2b
Author: yuhan0 <qyth...@gmail.com>
Commit: Bozhidar Batsov <bozhi...@batsov.dev>

    feat: specify default connection params
---
 cider.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/cider.el b/cider.el
index 99ac28585b..10e2d208e2 100644
--- a/cider.el
+++ b/cider.el
@@ -1443,14 +1443,21 @@ server buffer, in which case a new session for that 
server is created."
                    (plist-put :session-name ses-name)
                    (plist-put :repl-type 'cljs)))))
 
+(defvar-local cider-connect-default-params nil
+  "Default plist of params to pass to `cider-connect'.
+Recognized keys are :host, :port and :project-dir.")
+
 ;;;###autoload
 (defun cider-connect-clj (&optional params)
   "Initialize a Clojure connection to an nREPL server.
-PARAMS is a plist optionally containing :host, :port and :project-dir.  On
-prefix argument, prompt for all the parameters."
+PARAMS is a plist optionally containing :host, :port and :project-dir.
+If nil, use the default parameters in `cider-connect-default-params'.
+When called interactively with a prefix argument, prompt for all the
+parameters."
   (interactive "P")
   (cider-nrepl-connect
-   (thread-first params
+   ;; Make sure to copy the list, as the following steps will mutate it
+   (thread-first (or params (copy-sequence cider-connect-default-params))
                  (cider--update-project-dir)
                  (cider--update-host-port)
                  (cider--check-existing-session)

Reply via email to