Function: cider-insert-in-repl

cider-insert-in-repl is a byte-compiled function defined in cider-mode.el.

Signature

(cider-insert-in-repl FORM EVAL)

Documentation

Insert FORM in the REPL buffer and switch to it.

If EVAL is non-nil the form will also be evaluated. Use cider-invert-insert-eval-p to invert this behavior.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-mode.el
(defun cider-insert-in-repl (form eval)
  "Insert FORM in the REPL buffer and switch to it.
If EVAL is non-nil the form will also be evaluated.  Use
`cider-invert-insert-eval-p' to invert this behavior."
  (while (string-match "\\`[ \t\n\r]+\\|[ \t\n\r]+\\'" form)
    (setq form (replace-match "" t t form)))
  (when cider-switch-to-repl-on-insert
    (cider-switch-to-repl-buffer))
  (let ((repl (cider-current-repl)))
    (with-selected-window (or (get-buffer-window repl t)
                              (selected-window))
      (with-current-buffer repl
        (goto-char (point-max))
        (let ((beg (point)))
          (insert form)
          (indent-region beg (point))
          (font-lock-ensure beg (point)))
        (when (if cider-invert-insert-eval-p
                  (not eval)
                eval)
          (cider-repl-return))
        (goto-char (point-max))))))