Function: cider-maybe-insert-multiline-comment

cider-maybe-insert-multiline-comment is a byte-compiled function defined in cider-eval.el.

Signature

(cider-maybe-insert-multiline-comment RESULT COMMENT-PREFIX CONTINUED-PREFIX COMMENT-POSTFIX)

Documentation

Insert eval RESULT at current location if RESULT is not empty.

Returns bounds of the inserted text, or nil if nothing was inserted. RESULT will be preceded by COMMENT-PREFIX. CONTINUED-PREFIX is inserted for each additional line of output. COMMENT-POSTFIX is inserted after final text output.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider-maybe-insert-multiline-comment (result comment-prefix continued-prefix comment-postfix)
  "Insert eval RESULT at current location if RESULT is not empty.
Returns bounds of the inserted text, or nil if nothing was inserted.
RESULT will be preceded by COMMENT-PREFIX.
CONTINUED-PREFIX is inserted for each additional line of output.
COMMENT-POSTFIX is inserted after final text output."
  (unless (string= result "")
    ;; Make sure inserted comments are indented properly
    (indent-according-to-mode)
    (let ((lines (split-string result "[\n]" nil))
          (beg (point))
          (col (current-indentation)))
      ;; only the first line gets the normal comment-prefix
      (insert (concat comment-prefix (pop lines)))
      (dolist (elem lines)
        (insert (concat "\n" continued-prefix elem)))
      (insert comment-postfix)
      (indent-rigidly beg (line-end-position) col)
      (list beg (point)))))