Function: cider-eval-defun

cider-eval-defun is an interactive and byte-compiled function defined in cider-eval.el.

Signature

(cider-eval-defun &optional DEBUG-IT)

Documentation

Evaluate the current toplevel form, and print result in the minibuffer.

Inside a comment form the enclosed form is treated as the toplevel one; see cider-defun-at-point. With DEBUG-IT prefix argument, also debug the entire form as with the command cider-debug-defun.

Key Bindings

Aliases

cider-eval-defun-at-point (obsolete since 2.1.0)

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider-eval-defun (&optional debug-it)
  "Evaluate the current toplevel form, and print result in the minibuffer.
Inside a `comment' form the enclosed form is treated as the toplevel
one; see `cider-defun-at-point'.
With DEBUG-IT prefix argument, also debug the entire form as with the
command `cider-debug-defun'."
  (interactive "P")
  (let ((inline-debug (eq 16 (car-safe debug-it))))
    (when debug-it
      (when (cider-clojurescript-major-mode-p)
        (when (y-or-n-p "The debugger isn't available for ClojureScript.  Read about the alternatives (Cider Storm, browser DevTools)? ")
          (browse-url "https://docs.cider.mx/cider/cljs/overview.html"))
        (user-error "The debugger does not support ClojureScript"))
      (when inline-debug
        (cider--prompt-and-insert-inline-dbg)))
    (cider-interactive-eval (when (and debug-it (not inline-debug))
                              (concat "#dbg\n" (cider-defun-at-point)))
                            nil
                            (cider-defun-at-point 'bounds)
                            (cider--nrepl-pr-request-plist))))