Function: cider-eval-defun-to-comment

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

Signature

(cider-eval-defun-to-comment &optional INSERT-BEFORE)

Documentation

Evaluate the "top-level" form and insert result as comment.

The comment style is controlled by cider-comment-style (by default a
";; => " line comment; see also cider-comment-prefix).

With the prefix arg INSERT-BEFORE, insert before the form, otherwise afterwards.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider-eval-defun-to-comment (&optional insert-before)
  "Evaluate the \"top-level\" form and insert result as comment.

The comment style is controlled by `cider-comment-style' (by default a
\";; => \" line comment; see also `cider-comment-prefix').

With the prefix arg INSERT-BEFORE, insert before the form, otherwise afterwards."
  (interactive "P")
  (pcase-let* ((bounds (cider-defun-at-point 'bounds))
               (insertion-point (nth (if insert-before 0 1) bounds))
               (`(,prefix ,_ ,postfix) (cider--comment-format)))
    (cider-interactive-eval nil
                            (cider-eval-print-with-comment-handler
                             (current-buffer)
                             insertion-point
                             prefix
                             postfix)
                            bounds
                            (cider--nrepl-pr-request-plist))))