changeset 6998:40163ff9fc7c

(comint-mode): Set comint-last-input-start and comint-last-input-end to valid markers. (comint-send-input): Use comint-output-filter to run functions on comint-output-filter-functions. (comint-kill-output): Use delete-region to remove, and comint-output-filter to insert.
author Richard M. Stallman <rms@gnu.org>
date Thu, 21 Apr 1994 06:42:24 +0000
parents efca30974157
children dda3ecf64655
files lisp/comint.el
diffstat 1 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/comint.el	Thu Apr 21 06:24:36 1994 +0000
+++ b/lisp/comint.el	Thu Apr 21 06:42:24 1994 +0000
@@ -346,8 +346,10 @@
   (use-local-map comint-mode-map)
   (make-local-variable 'comint-last-input-start)
   (setq comint-last-input-start (make-marker))
+  (set-marker comint-last-input-start (point-min))
   (make-local-variable 'comint-last-input-end)
   (setq comint-last-input-end (make-marker))
+  (set-marker comint-last-input-end (point-min))
   (make-local-variable 'comint-last-output-start)
   (setq comint-last-output-start (make-marker))
   (make-local-variable 'comint-prompt-regexp)        ; Don't set; default
@@ -1130,13 +1132,7 @@
 	  (set-marker comint-last-input-start pmark)
 	  (set-marker comint-last-input-end (point))
 	  (set-marker (process-mark proc) (point))
-	  ;; A kludge to prevent the delay between insert and process output
-	  ;; affecting the display.  A case for a comint-send-input-hook?
-	  (if (eq (process-filter proc) 'comint-output-filter)
-	      (let ((functions comint-output-filter-functions))
-		(while functions
-		  (funcall (car functions) (concat input "\n"))
-		  (setq functions (cdr functions)))))))))
+	  (comint-output-filter proc "")))))
 
 ;; The purpose of using this filter for comint processes
 ;; is to keep comint-last-input-end from moving forward
@@ -1421,14 +1417,19 @@
   "Kill all output from interpreter since last input.
 Does not delete the prompt."
   (interactive)
-  (let ((pmark (progn (goto-char
-		       (process-mark (get-buffer-process (current-buffer))))
-		      (beginning-of-line nil)
-		      (point-marker))))
-    (kill-region comint-last-input-end pmark)
-    (insert "*** output flushed ***\n")
-    (comint-skip-prompt)
-    (set-marker pmark (point))))
+  (let ((proc (get-buffer-process (current-buffer)))
+	(replacement nil))
+    (save-excursion
+      (let ((pmark (progn (goto-char (process-mark proc))
+			  (beginning-of-line nil)
+			  (point-marker))))
+	(delete-region comint-last-input-end pmark)
+	(comint-skip-prompt)
+	(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)))
 
 (defun comint-show-output ()
   "Display start of this batch of interpreter output at top of window.