@@ -510,6 +510,19 @@ specifying the artifact ID, and the second element the version number."
510510 (string :tag " Artifact ID" )
511511 (string :tag " Version" ))))
512512
513+ (defvar-local cider-jack-in-cmd nil
514+ " The custom command used to start a nrepl server.
515+ This is used by `cider-jack-in`.
516+
517+ If this variable is set, its value will be
518+ used as the command to start the nrepl server
519+ instead of the default command inferred from
520+ the project type.
521+
522+ This allows for fine-grained control over the jack-in process.
523+ The value should be a string representing the command to start
524+ the nrepl server, such as \" nbb nrepl-server\" ." )
525+
513526(defvar cider-jack-in-lein-plugins nil
514527 " List of Leiningen plugins to be injected at jack-in.
515528Each element is a list of artifact name and version, followed optionally by
@@ -1494,43 +1507,46 @@ PARAMS is a plist with the following keys (non-exhaustive list)
14941507
14951508:project-type optional, the project type to create the command for; see
14961509`cider-jack-in-command' for the list of valid types)."
1497- (let* ((params (cider--update-do-prompt params))
1498- (project-dir (plist-get params :project-dir ))
1499- (params-project-type (plist-get params :project-type ))
1500- (project-type (or params-project-type
1501- (cider-project-type project-dir)))
1502- (command (cider-jack-in-command project-type))
1503- (command-resolved (cider-jack-in-resolve-command project-type))
1504- (command-global-opts (cider-jack-in-global-options project-type))
1505- (command-params (cider-jack-in-params project-type)))
1506- (if command-resolved
1507- (with-current-buffer (or (plist-get params :--context-buffer )
1508- (current-buffer ))
1509- (let* ((command-params (if (plist-get params :do-prompt )
1510- (read-string " nREPL server command: "
1511- command-params
1512- 'cider--jack-in-nrepl-params-history )
1513- command-params))
1514- (cmd-params (if cider-inject-dependencies-at-jack-in
1515- (cider-inject-jack-in-dependencies command-global-opts command-params project-type)
1516- command-params)))
1517- (if (or project-dir cider-allow-jack-in-without-project)
1518- (when (or project-dir
1519- (eq cider-allow-jack-in-without-project t )
1520- (and (null project-dir)
1521- (eq cider-allow-jack-in-without-project 'warn )
1522- (or params-project-type
1523- (y-or-n-p " Are you sure you want to run `cider-jack-in' without a Clojure project? " ))))
1524- (let ((cmd (format " %s %s " command-resolved (if (or (string-equal command " powershell" )
1525- (string-equal command " pwsh" ))
1526- (cider--powershell-encode-command cmd-params)
1527- cmd-params))))
1528- (plist-put params :jack-in-cmd (if (or cider-edit-jack-in-command
1529- (plist-get params :edit-jack-in-command ))
1530- (read-string " jack-in command: " cmd 'cider--jack-in-cmd-history )
1531- cmd))))
1532- (user-error " `cider-jack-in' is not allowed without a Clojure project" ))))
1533- (user-error " The %s executable isn't on your `exec-path' " command))))
1510+ (cond
1511+ ((plist-get params :jack-in-cmd ) params)
1512+ (cider-jack-in-cmd (plist-put params :jack-in-cmd cider-jack-in-cmd))
1513+ (t (let* ((params (cider--update-do-prompt params))
1514+ (project-dir (plist-get params :project-dir ))
1515+ (params-project-type (plist-get params :project-type ))
1516+ (project-type (or params-project-type
1517+ (cider-project-type project-dir)))
1518+ (command (cider-jack-in-command project-type))
1519+ (command-resolved (cider-jack-in-resolve-command project-type))
1520+ (command-global-opts (cider-jack-in-global-options project-type))
1521+ (command-params (cider-jack-in-params project-type)))
1522+ (if command-resolved
1523+ (with-current-buffer (or (plist-get params :--context-buffer )
1524+ (current-buffer ))
1525+ (let* ((command-params (if (plist-get params :do-prompt )
1526+ (read-string " nREPL server command: "
1527+ command-params
1528+ 'cider--jack-in-nrepl-params-history )
1529+ command-params))
1530+ (cmd-params (if cider-inject-dependencies-at-jack-in
1531+ (cider-inject-jack-in-dependencies command-global-opts command-params project-type)
1532+ command-params)))
1533+ (if (or project-dir cider-allow-jack-in-without-project)
1534+ (when (or project-dir
1535+ (eq cider-allow-jack-in-without-project t )
1536+ (and (null project-dir)
1537+ (eq cider-allow-jack-in-without-project 'warn )
1538+ (or params-project-type
1539+ (y-or-n-p " Are you sure you want to run `cider-jack-in' without a Clojure project? " ))))
1540+ (let ((cmd (format " %s %s " command-resolved (if (or (string-equal command " powershell" )
1541+ (string-equal command " pwsh" ))
1542+ (cider--powershell-encode-command cmd-params)
1543+ cmd-params))))
1544+ (plist-put params :jack-in-cmd (if (or cider-edit-jack-in-command
1545+ (plist-get params :edit-jack-in-command ))
1546+ (read-string " jack-in command: " cmd 'cider--jack-in-cmd-history )
1547+ cmd))))
1548+ (user-error " `cider-jack-in' is not allowed without a Clojure project" ))))
1549+ (user-error " The %s executable isn't on your `exec-path' " command))))))
15341550
15351551(defun cider--update-host-port (params )
15361552 " Update :host and :port; or :socket-file in PARAMS."
0 commit comments