Function: cider-jack-in-universal

cider-jack-in-universal is an autoloaded, interactive and byte-compiled function defined in cider.el.

Signature

(cider-jack-in-universal ARG)

Documentation

Start and connect to an nREPL server for the current project or ARG project id.

If a project is found in current dir, call cider-jack-in passing ARG as first parameter, of which see. Otherwise, ask user which project type to start an nREPL server and connect to without a project.

But if invoked with a numeric prefix ARG, then start an nREPL server for the project type denoted by ARG number and connect to it, even if there is no project for it in the current dir.

The supported project tools and their assigned numeric prefix ids are sourced from cider-jack-in-universal-options, of which see.

You can pass a numeric prefix argument n with `M-n` or `C-u n`.

For example, to jack in to leiningen which is assigned to prefix arg 2 type

M-2 M-x cider-jack-in-universal (cider-jack-in-universal).

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider.el
;;;###autoload
(defun cider-jack-in-universal (arg)
  "Start and connect to an nREPL server for the current project or ARG project id.

If a project is found in current dir, call `cider-jack-in' passing ARG as
first parameter, of which see.  Otherwise, ask user which project type to
start an nREPL server and connect to without a project.

But if invoked with a numeric prefix ARG, then start an nREPL server for
the project type denoted by ARG number and connect to it, even if there is
no project for it in the current dir.

The supported project tools and their assigned numeric prefix ids are
sourced from `cider-jack-in-universal-options', of which see.

You can pass a numeric prefix argument n with `M-n` or `C-u n`.

For example, to jack in to leiningen which is assigned to prefix arg 2 type

M-2 \\[cider-jack-in-universal]."
  (interactive "P")
  (let ((cpt (clojure-project-dir (cider-current-dir))))
    (if (or (integerp arg) (null cpt))
        (let* ((project-types-available (mapcar #'car cider-jack-in-universal-options))
               (project-type (if (null arg)
                                 (intern (completing-read
                                          "No project found in current dir, select project type to jack in: "
                                          project-types-available
                                          nil t))

                               (or (seq-some (lambda (elt)
                                               (cl-destructuring-bind
                                                   (project-type (&key prefix-arg &allow-other-keys)) elt
                                                 (when (= arg prefix-arg)
                                                   project-type)))
                                             cider-jack-in-universal-options)
                                   (error ":cider-jack-in-universal :unsupported-prefix-argument %S :no-such-project"
                                          arg))))
               (project-options (cadr (seq-find (lambda (elt) (equal project-type (car elt)))
                                                cider-jack-in-universal-options)))
               (jack-in-opts (plist-get project-options :cmd))
               (jack-in-type (plist-get jack-in-opts :jack-in-type)))
          (pcase jack-in-type
            ('clj (cider-jack-in-clj jack-in-opts))
            ('cljs (cider-jack-in-cljs jack-in-opts))
            (_ (error ":cider-jack-in-universal :jack-in-type-unsupported %S" jack-in-type))))

      (cider-jack-in-clj arg))))