changeset 19515:a0ecbe13b54b

(comint-preoutput-filter-functions): New variable. (comint-output-filter): Call those functions. (comint-output-filter-functions, comint-mode): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Sun, 24 Aug 1997 21:38:12 +0000
parents 9f6b375ce842
children 6591f294b265
files lisp/comint.el
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/comint.el	Sun Aug 24 21:28:21 1997 +0000
+++ b/lisp/comint.el	Sun Aug 24 21:38:12 1997 +0000
@@ -125,6 +125,7 @@
 ;;  comint-get-old-input		function Hooks for specific 
 ;;  comint-input-filter-functions	hook	process-in-a-buffer
 ;;  comint-output-filter-functions	hook	function modes.
+;;  comint-preoutput-filter-functions   hook
 ;;  comint-input-filter			function ...
 ;;  comint-input-sender			function ...
 ;;  comint-eol-on-send			boolean	...
@@ -312,6 +313,8 @@
 `comint-last-output-start' and the buffer's `process-mark', if other filter
 functions have already modified the buffer.
 
+See also `comint-preoutput-filter-functions'.
+
 This variable is buffer-local.")
 
 (defvar comint-input-sender (function comint-simple-send)
@@ -363,6 +366,7 @@
 (put 'comint-input-autoexpand 'permanent-local t)
 (put 'comint-input-filter-functions 'permanent-local t)
 (put 'comint-output-filter-functions 'permanent-local t)
+(put 'comint-preoutput-filter-functions 'permanent-local t)
 (put 'comint-scroll-to-bottom-on-input 'permanent-local t)
 (put 'comint-scroll-to-bottom-on-output 'permanent-local t)
 (put 'comint-scroll-show-maximum-output 'permanent-local t)
@@ -397,7 +401,8 @@
 
 Input to, and output from, the subprocess can cause the window to scroll to
 the end of the buffer.  See variables `comint-output-filter-functions',
-`comint-scroll-to-bottom-on-input', and `comint-scroll-to-bottom-on-output'.
+`comint-preoutput-filter-functions', `comint-scroll-to-bottom-on-input',
+and `comint-scroll-to-bottom-on-output'.
 
 If you accidentally suspend your process, use \\[comint-continue-subjob]
 to continue it.
@@ -1247,13 +1252,24 @@
 	  ;; but that scrolled the buffer in undesirable ways.
 	  (run-hook-with-args 'comint-output-filter-functions "")))))
 
+(defvar comint-preoutput-filter-functions nil 
+  "Functions to call after output is inserted into the buffer.
+These functions get one argument, a string containing the text to be
+inserted.  They return the string as it should be inserted.
+
+This variable is buffer-local.")
+
 ;; The purpose of using this filter for comint processes
 ;; is to keep comint-last-input-end from moving forward
 ;; when output is inserted.
 (defun comint-output-filter (process string)
   ;; First check for killed buffer
   (let ((oprocbuf (process-buffer process)))
-    (if (and oprocbuf (buffer-name oprocbuf))
+    (let ((functions comint-preoutput-filter-functions))
+      (while (and functions string)
+	(setq string (funcall (car functions) string))
+	(setq functions (cdr functions))))
+    (if (and string oprocbuf (buffer-name oprocbuf))
 	(let ((obuf (current-buffer))
 	      (opoint nil) (obeg nil) (oend nil))
 	  (set-buffer oprocbuf)