Function: cider-pprint-form-to-comment

cider-pprint-form-to-comment is a byte-compiled function defined in cider-eval.el.

Signature

(cider-pprint-form-to-comment FORM-FN INSERT-BEFORE)

Documentation

Evaluate the form selected by FORM-FN and insert result as comment.

FORM-FN can be either cider-last-sexp or cider-defun-at-point.

The formatting of the comment is controlled via three options:
    cider-comment-prefix ";; => "
    cider-comment-continued-prefix ";; "
    cider-comment-postfix ""

so that with customization you can optionally wrap the output in the reader macro "#_( .. )", or "(comment ... )", or any other desired formatting.

If INSERT-BEFORE is non-nil, insert before the form, otherwise afterwards.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-eval.el
(defun cider-pprint-form-to-comment (form-fn insert-before)
  "Evaluate the form selected by FORM-FN and insert result as comment.
FORM-FN can be either `cider-last-sexp' or `cider-defun-at-point'.

The formatting of the comment is controlled via three options:
    `cider-comment-prefix'           \";; => \"
    `cider-comment-continued-prefix' \";;    \"
    `cider-comment-postfix'          \"\"

so that with customization you can optionally wrap the output
in the reader macro \"#_( .. )\", or \"(comment ... )\", or any
other desired formatting.

If INSERT-BEFORE is non-nil, insert before the form, otherwise afterwards."
  (let* ((bounds (funcall form-fn 'bounds))
         (insertion-point (nth (if insert-before 0 1) bounds))
         ;; when insert-before, we need a newline after the output to
         ;; avoid commenting the first line of the form
         (comment-postfix (concat cider-comment-postfix
                                  (if insert-before "\n" ""))))
    (cider-interactive-eval nil
                            (cider-eval-pprint-with-multiline-comment-handler
                             (current-buffer)
                             (set-marker (make-marker) insertion-point)
                             cider-comment-prefix
                             cider-comment-continued-prefix
                             comment-postfix)
                            bounds
                            (cider--nrepl-print-request-plist fill-column))))