[comp.emacs] GNUemacs - kill-output-from-shell mods

ed%zinfandel@zehntel.UUCP (Ed Hirgelt) (03/13/87)

The standard behavior of shell.el's kill-output-from-shell has been
annoying me (version 18.36). The output flushed message behaved just
like I typed is as a command and I didn't get the shell prompt for the
next command. The version below solves the problem by being more
careful about what it tosses away. After moving to the end of the
buffer, it backs up to the start of the next line, then kills
everything back to the end of the last input. Finally it moves the
point back to the end of the file.

(defun kill-output-from-shell ()
  "Kill all output from shell since last input."
  (interactive)
  (goto-char (point-max))
  (beginning-of-line)
  (kill-region last-input-end (point))
  (insert "*** output flushed ***\n")
  (goto-char (point-max)))

Ed Hirgelt
Zehntel Automation Systems	{ihnp4 ucbvax}!zehntel!ed
2625 Shadelands Drive		zehntel!ed@Berkeley.ARPA
Walnut Creek, Ca 94598