diff options
| author | Richard M. Stallman | 1997-08-24 21:38:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-08-24 21:38:12 +0000 |
| commit | d4321160f203cfb4d54474dd44cd80df4e66bd0f (patch) | |
| tree | 59adf80646d7bfc177c19684253e62794b7414c9 /lisp | |
| parent | ecb7ad00485adc5160411650ac7514dff9b3b8d9 (diff) | |
| download | emacs-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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/comint.el | 20 |
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 |
| 313 | functions have already modified the buffer. | 314 | functions have already modified the buffer. |
| 314 | 315 | ||
| 316 | See also `comint-preoutput-filter-functions'. | ||
| 317 | |||
| 315 | This variable is buffer-local.") | 318 | This 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 | ||
| 398 | Input to, and output from, the subprocess can cause the window to scroll to | 402 | Input to, and output from, the subprocess can cause the window to scroll to |
| 399 | the end of the buffer. See variables `comint-output-filter-functions', | 403 | the 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', |
| 405 | and `comint-scroll-to-bottom-on-output'. | ||
| 401 | 406 | ||
| 402 | If you accidentally suspend your process, use \\[comint-continue-subjob] | 407 | If you accidentally suspend your process, use \\[comint-continue-subjob] |
| 403 | to continue it. | 408 | to 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. | ||
| 1257 | These functions get one argument, a string containing the text to be | ||
| 1258 | inserted. They return the string as it should be inserted. | ||
| 1259 | |||
| 1260 | This 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) |