Function: comint-delete-output
comint-delete-output is an interactive and byte-compiled function
defined in comint.el.gz.
Signature
(comint-delete-output &optional KILL)
Documentation
Delete all output from interpreter since last input.
If KILL (interactively, the prefix), save the killed text in the kill ring.
This command does not delete the prompt.
Probably introduced at or before Emacs version 21.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/comint.el.gz
;; Random input hackage
(defun comint-delete-output (&optional kill)
"Delete all output from interpreter since last input.
If KILL (interactively, the prefix), save the killed text in the
kill ring.
This command does not delete the prompt."
(interactive "P" comint-mode)
(let ((proc (get-buffer-process (current-buffer)))
(replacement nil)
(inhibit-read-only t))
(save-excursion
(let ((pmark (progn (goto-char (process-mark proc))
(forward-line 0)
(point-marker))))
(when kill
(copy-region-as-kill comint-last-input-end pmark))
(delete-region comint-last-input-end pmark)
(goto-char (process-mark proc))
(setq replacement (concat "*** output flushed ***\n"
(buffer-substring pmark (point))))
(delete-region pmark (point))))
;; Output message and put back prompt
(comint-output-filter proc replacement)))