Skip to content

Commit

Permalink
feat: specify default connection params
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhan0 committed May 7, 2024
1 parent 4f53c0b commit 51e84e7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cider.el
Original file line number Diff line number Diff line change
Expand Up @@ -1504,14 +1504,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)
Expand Down

0 comments on commit 51e84e7

Please sign in to comment.