aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-08-24 21:38:12 +0000
committerRichard M. Stallman1997-08-24 21:38:12 +0000
commitd4321160f203cfb4d54474dd44cd80df4e66bd0f (patch)
tree59adf80646d7bfc177c19684253e62794b7414c9
parentecb7ad00485adc5160411650ac7514dff9b3b8d9 (diff)
downloademacs-d4321160f203cfb4d54474dd44cd80df4e66bd0f.tar.gz
emacs-d4321160f203cfb4d54474dd44cd80df4e66bd0f.zip
(comint-preoutput-filter-functions): New variable.
(comint-output-filter): Call those functions. (comint-output-filter-functions, comint-mode): Doc fix.
-rw-r--r--lisp/comint.el20
1 files changed, 18 insertions, 2 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index d6799e0c007..bcf45223022 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -125,6 +125,7 @@
125;; comint-get-old-input function Hooks for specific 125;; comint-get-old-input function Hooks for specific
126;; comint-input-filter-functions hook process-in-a-buffer 126;; comint-input-filter-functions hook process-in-a-buffer
127;; comint-output-filter-functions hook function modes. 127;; comint-output-filter-functions hook function modes.
128;; comint-preoutput-filter-functions hook
128;; comint-input-filter function ... 129;; comint-input-filter function ...
129;; comint-input-sender function ... 130;; comint-input-sender function ...
130;; comint-eol-on-send boolean ... 131;; comint-eol-on-send boolean ...
@@ -312,6 +313,8 @@ inserted. Note that this might not be the same as the buffer contents between
312`comint-last-output-start' and the buffer's `process-mark', if other filter 313`comint-last-output-start' and the buffer's `process-mark', if other filter
313functions have already modified the buffer. 314functions have already modified the buffer.
314 315
316See also `comint-preoutput-filter-functions'.
317
315This variable is buffer-local.") 318This variable is buffer-local.")
316 319
317(defvar comint-input-sender (function comint-simple-send) 320(defvar comint-input-sender (function comint-simple-send)
@@ -363,6 +366,7 @@ This is to work around a bug in Emacs process signaling.")
363(put 'comint-input-autoexpand 'permanent-local t) 366(put 'comint-input-autoexpand 'permanent-local t)
364(put 'comint-input-filter-functions 'permanent-local t) 367(put 'comint-input-filter-functions 'permanent-local t)
365(put 'comint-output-filter-functions 'permanent-local t) 368(put 'comint-output-filter-functions 'permanent-local t)
369(put 'comint-preoutput-filter-functions 'permanent-local t)
366(put 'comint-scroll-to-bottom-on-input 'permanent-local t) 370(put 'comint-scroll-to-bottom-on-input 'permanent-local t)
367(put 'comint-scroll-to-bottom-on-output 'permanent-local t) 371(put 'comint-scroll-to-bottom-on-output 'permanent-local t)
368(put 'comint-scroll-show-maximum-output 'permanent-local t) 372(put 'comint-scroll-show-maximum-output 'permanent-local t)
@@ -397,7 +401,8 @@ Commands with no default key bindings include `send-invisible',
397 401
398Input to, and output from, the subprocess can cause the window to scroll to 402Input to, and output from, the subprocess can cause the window to scroll to
399the end of the buffer. See variables `comint-output-filter-functions', 403the end of the buffer. See variables `comint-output-filter-functions',
400`comint-scroll-to-bottom-on-input', and `comint-scroll-to-bottom-on-output'. 404`comint-preoutput-filter-functions', `comint-scroll-to-bottom-on-input',
405and `comint-scroll-to-bottom-on-output'.
401 406
402If you accidentally suspend your process, use \\[comint-continue-subjob] 407If you accidentally suspend your process, use \\[comint-continue-subjob]
403to continue it. 408to continue it.
@@ -1247,13 +1252,24 @@ Similarly for Soar, Scheme, etc."
1247 ;; but that scrolled the buffer in undesirable ways. 1252 ;; but that scrolled the buffer in undesirable ways.
1248 (run-hook-with-args 'comint-output-filter-functions ""))))) 1253 (run-hook-with-args 'comint-output-filter-functions "")))))
1249 1254
1255(defvar comint-preoutput-filter-functions nil
1256 "Functions to call after output is inserted into the buffer.
1257These functions get one argument, a string containing the text to be
1258inserted. They return the string as it should be inserted.
1259
1260This variable is buffer-local.")
1261
1250;; The purpose of using this filter for comint processes 1262;; The purpose of using this filter for comint processes
1251;; is to keep comint-last-input-end from moving forward 1263;; is to keep comint-last-input-end from moving forward
1252;; when output is inserted. 1264;; when output is inserted.
1253(defun comint-output-filter (process string) 1265(defun comint-output-filter (process string)
1254 ;; First check for killed buffer 1266 ;; First check for killed buffer
1255 (let ((oprocbuf (process-buffer process))) 1267 (let ((oprocbuf (process-buffer process)))
1256 (if (and oprocbuf (buffer-name oprocbuf)) 1268 (let ((functions comint-preoutput-filter-functions))
1269 (while (and functions string)
1270 (setq string (funcall (car functions) string))
1271 (setq functions (cdr functions))))
1272 (if (and string oprocbuf (buffer-name oprocbuf))
1257 (let ((obuf (current-buffer)) 1273 (let ((obuf (current-buffer))
1258 (opoint nil) (obeg nil) (oend nil)) 1274 (opoint nil) (obeg nil) (oend nil))
1259 (set-buffer oprocbuf) 1275 (set-buffer oprocbuf)