Function: comint-accumulate

comint-accumulate is an interactive and byte-compiled function defined in comint.el.gz.

Signature

(comint-accumulate)

Documentation

Accumulate a line to send as input along with more lines.

This inserts a newline so that you can enter more text to be sent along with this line. Use M-x comint-send-input (comint-send-input) to send all the accumulated input, at once. The entire accumulated text becomes one item in the input history when you send it.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-accumulate ()
  "Accumulate a line to send as input along with more lines.
This inserts a newline so that you can enter more text
to be sent along with this line.  Use \\[comint-send-input]
to send all the accumulated input, at once.
The entire accumulated text becomes one item in the input history
when you send it."
  (interactive nil comint-mode)
  (when-let* ((proc (get-buffer-process (current-buffer)))
              (pmark (process-mark proc))
              ((or (marker-position comint-accum-marker)
                   (set-marker comint-accum-marker pmark)
                   t))
              ((>= (point) comint-accum-marker pmark)))
    ;; Delete and reinsert input.  This seems like a no-op, except for
    ;; the resulting entries in the undo list: undoing this insertion
    ;; will delete the region, moving the accumulation marker back to
    ;; its original position.
    (let ((text (buffer-substring comint-accum-marker (point)))
          (inhibit-read-only t))
      (delete-region comint-accum-marker (point))
      (insert text)))
  (insert "\n")
  (set-marker comint-accum-marker (point))
  (if comint-input-ring-index
      (setq comint-save-input-ring-index
	    (- comint-input-ring-index 1))))