Function: cider-run
cider-run is an interactive and byte-compiled function defined in
cider-mode.el.
Signature
(cider-run &optional FUNCTION)
Documentation
Run -main or FUNCTION, prompting for its namespace if necessary.
With a prefix argument, prompt for function to run instead of -main.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-mode.el
(defun cider-run (&optional function)
"Run -main or FUNCTION, prompting for its namespace if necessary.
With a prefix argument, prompt for function to run instead of -main."
(interactive (list (when current-prefix-arg (read-string "Function name: "))))
(cider-ensure-connected)
(let ((name (or function "-main")))
(when-let* ((response (cider-nrepl-send-sync-request
`("op" "ns-list-vars-by-name"
"name" ,name))))
(if-let* ((vars (split-string (substring (nrepl-dict-get response "var-list") 1 -1))))
(cider-interactive-eval
(if (= (length vars) 1)
(concat "(" (car vars) ")")
(let* ((completions (mapcar #'cider--var-namespace vars))
(def (or (car cider--namespace-history)
(car completions))))
(format "(#'%s/%s)"
(completing-read (format "Namespace (%s): " def)
completions nil t nil
'cider--namespace-history def)
name))))
(user-error "No %s var defined in any namespace" (cider-propertize name 'fn))))))