Function: cider-repl--grab-old-input

cider-repl--grab-old-input is a byte-compiled function defined in cider-repl.el.

Signature

(cider-repl--grab-old-input REPLACE)

Documentation

Resend the old REPL input at point.

If REPLACE is non-nil the current input is replaced with the old input; otherwise the new input is appended. The old input has the text property cider-old-input.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-repl.el
(defun cider-repl--grab-old-input (replace)
  "Resend the old REPL input at point.
If REPLACE is non-nil the current input is replaced with the old
input; otherwise the new input is appended.  The old input has the
text property `cider-old-input'."
  (pcase-let ((`(,beg ,end) (cider-property-bounds 'cider-old-input)))
    (let ((old-input (buffer-substring beg end)) ;;preserve
          ;;properties, they will be removed later
          (offset (- (point) beg)))
      ;; Append the old input or replace the current input
      (cond (replace (goto-char cider-repl-input-start-mark))
            (t (goto-char (point-max))
               (unless (eq (char-before) ?\ )
                 (insert " "))))
      (delete-region (point) (point-max))
      (save-excursion
        (insert old-input)
        (when (equal (char-before) ?\n)
          (delete-char -1)))
      (forward-char offset))))