aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-03-03 23:53:46 +0000
committerRichard M. Stallman1994-03-03 23:53:46 +0000
commitfb9ab28af0a6d555d73ea320f29c66676fb08640 (patch)
treee4d92e7b655024b8f1606fdabea24c4a1203e996
parent988a4d60ceddc04f86a5d691b165f257e17a8633 (diff)
downloademacs-fb9ab28af0a6d555d73ea320f29c66676fb08640.tar.gz
emacs-fb9ab28af0a6d555d73ea320f29c66676fb08640.zip
(comint-input-filter-functions)
(comint-output-filter-functions): Renamed from ...-sentinel-functions.
-rw-r--r--lisp/comint.el51
1 files changed, 27 insertions, 24 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index b6c5fdbd19a..f37cfc76262 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -117,8 +117,8 @@
117;;; comint-last-input-match - string ... 117;;; comint-last-input-match - string ...
118;;; comint-dynamic-complete-functions - hook For the completion mechanism 118;;; comint-dynamic-complete-functions - hook For the completion mechanism
119;;; comint-get-old-input - function Hooks for specific 119;;; comint-get-old-input - function Hooks for specific
120;;; comint-input-sentinel-functions - hook process-in-a-buffer 120;;; comint-input-filter-functions - hook process-in-a-buffer
121;;; comint-output-sentinel-functions - hook function modes. 121;;; comint-output-filter-functions - hook function modes.
122;;; comint-input-filter - function ... 122;;; comint-input-filter - function ...
123;;; comint-input-send - function ... 123;;; comint-input-send - function ...
124;;; comint-eol-on-send - boolean ... 124;;; comint-eol-on-send - boolean ...
@@ -239,13 +239,13 @@ This is a good thing to set in mode hooks.")
239Takes one argument, the input. If non-nil, the input may be saved on the input 239Takes one argument, the input. If non-nil, the input may be saved on the input
240history list. Default is to save anything that isn't all whitespace.") 240history list. Default is to save anything that isn't all whitespace.")
241 241
242(defvar comint-input-sentinel-functions '() 242(defvar comint-input-filter-functions '()
243 "Functions to call before input is sent to the process. 243 "Functions to call before input is sent to the process.
244These functions get one argument, a string containing the text to send. 244These functions get one argument, a string containing the text to send.
245 245
246This variable is buffer-local.") 246This variable is buffer-local.")
247 247
248(defvar comint-output-sentinel-functions '(comint-postoutput-scroll-to-bottom) 248(defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom)
249 "Functions to call after output is inserted into the buffer. 249 "Functions to call after output is inserted into the buffer.
250One possible function is `comint-postoutput-scroll-to-bottom'. 250One possible function is `comint-postoutput-scroll-to-bottom'.
251These functions get one argument, a string containing the text just inserted. 251These functions get one argument, a string containing the text just inserted.
@@ -291,8 +291,8 @@ This is to work around a bug in Emacs process signalling.")
291(put 'comint-input-ring 'permanent-local t) 291(put 'comint-input-ring 'permanent-local t)
292(put 'comint-input-ring-index 'permanent-local t) 292(put 'comint-input-ring-index 'permanent-local t)
293(put 'comint-input-autoexpand 'permanent-local t) 293(put 'comint-input-autoexpand 'permanent-local t)
294(put 'comint-input-sentinel-functions 'permanent-local t) 294(put 'comint-input-filter-functions 'permanent-local t)
295(put 'comint-output-sentinel-functions 'permanent-local t) 295(put 'comint-output-filter-functions 'permanent-local t)
296(put 'comint-scroll-to-bottom-on-input 'permanent-local t) 296(put 'comint-scroll-to-bottom-on-input 'permanent-local t)
297(put 'comint-scroll-to-bottom-on-output 'permanent-local t) 297(put 'comint-scroll-to-bottom-on-output 'permanent-local t)
298(put 'comint-scroll-show-maximum-output 'permanent-local t) 298(put 'comint-scroll-show-maximum-output 'permanent-local t)
@@ -308,7 +308,7 @@ before submitting new input.
308 308
309This mode is customised to create major modes such as Inferior Lisp 309This mode is customised to create major modes such as Inferior Lisp
310mode, Shell mode, etc. This can be done by setting the hooks 310mode, Shell mode, etc. This can be done by setting the hooks
311`comint-input-sentinel-functions', `comint-input-filter', `comint-input-sender' 311`comint-input-filter-functions', `comint-input-filter', `comint-input-sender'
312and `comint-get-old-input' to appropriate functions, and the variable 312and `comint-get-old-input' to appropriate functions, and the variable
313`comint-prompt-regexp' to the appropriate regular expression. 313`comint-prompt-regexp' to the appropriate regular expression.
314 314
@@ -324,7 +324,7 @@ Commands with no default key bindings include `send-invisible',
324`comint-magic-space'. 324`comint-magic-space'.
325 325
326Input to, and output from, the subprocess can cause the window to scroll to 326Input to, and output from, the subprocess can cause the window to scroll to
327the end of the buffer. See variables `comint-output-sentinel-functions', 327the end of the buffer. See variables `comint-output-filter-functions',
328`comint-scroll-to-bottom-on-input', and `comint-scroll-to-bottom-on-output'. 328`comint-scroll-to-bottom-on-input', and `comint-scroll-to-bottom-on-output'.
329 329
330If you accidentally suspend your process, use \\[comint-continue-subjob] 330If you accidentally suspend your process, use \\[comint-continue-subjob]
@@ -361,7 +361,7 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
361 (make-local-variable 'comint-delimiter-argument-list) 361 (make-local-variable 'comint-delimiter-argument-list)
362 (make-local-variable 'comint-dynamic-complete-functions) 362 (make-local-variable 'comint-dynamic-complete-functions)
363 (make-local-variable 'comint-get-old-input) 363 (make-local-variable 'comint-get-old-input)
364 (make-local-variable 'comint-input-sentinel-functions) 364 (make-local-variable 'comint-input-filter-functions)
365 (make-local-variable 'comint-input-filter) 365 (make-local-variable 'comint-input-filter)
366 (make-local-variable 'comint-input-sender) 366 (make-local-variable 'comint-input-sender)
367 (make-local-variable 'comint-eol-on-send) 367 (make-local-variable 'comint-eol-on-send)
@@ -370,7 +370,7 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
370 (make-local-variable 'comint-scroll-show-maximum-output) 370 (make-local-variable 'comint-scroll-show-maximum-output)
371 (make-local-variable 'pre-command-hook) 371 (make-local-variable 'pre-command-hook)
372 (add-hook 'pre-command-hook 'comint-preinput-scroll-to-bottom) 372 (add-hook 'pre-command-hook 'comint-preinput-scroll-to-bottom)
373 (make-local-variable 'comint-output-sentinel-functions) 373 (make-local-variable 'comint-output-filter-functions)
374 (make-local-variable 'comint-ptyp) 374 (make-local-variable 'comint-ptyp)
375 (make-local-variable 'comint-exec-hook) 375 (make-local-variable 'comint-exec-hook)
376 (make-local-variable 'comint-process-echoes) 376 (make-local-variable 'comint-process-echoes)
@@ -878,7 +878,8 @@ See `comint-replace-by-expanded-history'. Returns t if successful."
878 (progn 878 (progn
879 (replace-match 879 (replace-match
880 (comint-args (comint-previous-input-string number) 880 (comint-args (comint-previous-input-string number)
881 (match-beginning 2) (match-end 2)) t t) 881 (match-beginning 2) (match-end 2))
882 t t)
882 (setq comint-input-ring-index number) 883 (setq comint-input-ring-index number)
883 (message "History item: %d" (1+ number))) 884 (message "History item: %d" (1+ number)))
884 (goto-char (match-end 0)) 885 (goto-char (match-end 0))
@@ -887,7 +888,8 @@ See `comint-replace-by-expanded-history'. Returns t if successful."
887 ;; Just a number of args from the previous input line. 888 ;; Just a number of args from the previous input line.
888 (replace-match 889 (replace-match
889 (comint-args (comint-previous-input-string 0) 890 (comint-args (comint-previous-input-string 0)
890 (match-beginning 1) (match-end 1)) t t) 891 (match-beginning 1) (match-end 1))
892 t t)
891 (message "History item: previous")) 893 (message "History item: previous"))
892 ((looking-at 894 ((looking-at
893 "!\\??\\({\\(.+\\)}\\|\\(\\sw+\\)\\)\\(:?[0-9^$*-]+\\)?") 895 "!\\??\\({\\(.+\\)}\\|\\(\\sw+\\)\\)\\(:?[0-9^$*-]+\\)?")
@@ -908,7 +910,8 @@ See `comint-replace-by-expanded-history'. Returns t if successful."
908 (setq comint-input-ring-index pos) 910 (setq comint-input-ring-index pos)
909 (replace-match 911 (replace-match
910 (comint-args (ring-ref comint-input-ring pos) 912 (comint-args (ring-ref comint-input-ring pos)
911 (match-beginning 4) (match-end 4)) t t) 913 (match-beginning 4) (match-end 4))
914 t t)
912 (message "History item: %d" (1+ pos))))) 915 (message "History item: %d" (1+ pos)))))
913 ((looking-at "\\^\\([^^]+\\)\\^?\\([^^]*\\)\\^?") 916 ((looking-at "\\^\\([^^]+\\)\\^?\\([^^]*\\)\\^?")
914 ;; Quick substitution on the previous input line. 917 ;; Quick substitution on the previous input line.
@@ -1030,28 +1033,28 @@ since it is assumed the remote process will re-echo it).
1030 1033
1031Any history reference may be expanded depending on the value of the variable 1034Any history reference may be expanded depending on the value of the variable
1032`comint-input-autoexpand'. The list of function names contained in the value 1035`comint-input-autoexpand'. The list of function names contained in the value
1033of `comint-input-sentinel-functions' is called on the input before sending it. 1036of `comint-input-filter-functions' is called on the input before sending it.
1034The input is entered into the input history ring, if the value of variable 1037The input is entered into the input history ring, if the value of variable
1035`comint-input-filter' returns non-nil when called on the input. 1038`comint-input-filter' returns non-nil when called on the input.
1036 1039
1037If variable `comint-eol-on-send' is non-nil, then point is moved to the 1040If variable `comint-eol-on-send' is non-nil, then point is moved to the
1038end of line before sending the input. 1041end of line before sending the input.
1039 1042
1040The values of `comint-get-old-input', `comint-input-sentinel-functions', and 1043The values of `comint-get-old-input', `comint-input-filter-functions', and
1041`comint-input-filter' are chosen according to the command interpreter running 1044`comint-input-filter' are chosen according to the command interpreter running
1042in the buffer. E.g., 1045in the buffer. E.g.,
1043 1046
1044If the interpreter is the csh, 1047If the interpreter is the csh,
1045 comint-get-old-input is the default: take the current line, discard any 1048 comint-get-old-input is the default: take the current line, discard any
1046 initial string matching regexp comint-prompt-regexp. 1049 initial string matching regexp comint-prompt-regexp.
1047 comint-input-sentinel-functions monitors input for \"cd\", \"pushd\", and 1050 comint-input-filter-functions monitors input for \"cd\", \"pushd\", and
1048 \"popd\" commands. When it sees one, it cd's the buffer. 1051 \"popd\" commands. When it sees one, it cd's the buffer.
1049 comint-input-filter is the default: returns t if the input isn't all white 1052 comint-input-filter is the default: returns t if the input isn't all white
1050 space. 1053 space.
1051 1054
1052If the comint is Lucid Common Lisp, 1055If the comint is Lucid Common Lisp,
1053 comint-get-old-input snarfs the sexp ending at point. 1056 comint-get-old-input snarfs the sexp ending at point.
1054 comint-input-sentinel-functions does nothing. 1057 comint-input-filter-functions does nothing.
1055 comint-input-filter returns nil if the input matches input-filter-regexp, 1058 comint-input-filter returns nil if the input matches input-filter-regexp,
1056 which matches (1) all whitespace (2) :a, :c, etc. 1059 which matches (1) all whitespace (2) :a, :c, etc.
1057 1060
@@ -1094,7 +1097,7 @@ Similarly for Soar, Scheme, etc."
1094 (not (string-equal (ring-ref comint-input-ring 0) 1097 (not (string-equal (ring-ref comint-input-ring 0)
1095 history)))) 1098 history))))
1096 (ring-insert comint-input-ring history)) 1099 (ring-insert comint-input-ring history))
1097 (let ((functions comint-input-sentinel-functions)) 1100 (let ((functions comint-input-filter-functions))
1098 (while functions 1101 (while functions
1099 (funcall (car functions) (concat input "\n")) 1102 (funcall (car functions) (concat input "\n"))
1100 (setq functions (cdr functions)))) 1103 (setq functions (cdr functions))))
@@ -1106,7 +1109,7 @@ Similarly for Soar, Scheme, etc."
1106 ;; A kludge to prevent the delay between insert and process output 1109 ;; A kludge to prevent the delay between insert and process output
1107 ;; affecting the display. A case for a comint-send-input-hook? 1110 ;; affecting the display. A case for a comint-send-input-hook?
1108 (if (eq (process-filter proc) 'comint-output-filter) 1111 (if (eq (process-filter proc) 'comint-output-filter)
1109 (let ((functions comint-output-sentinel-functions)) 1112 (let ((functions comint-output-filter-functions))
1110 (while functions 1113 (while functions
1111 (funcall (car functions) (concat input "\n")) 1114 (funcall (car functions) (concat input "\n"))
1112 (setq functions (cdr functions))))))))) 1115 (setq functions (cdr functions)))))))))
@@ -1151,7 +1154,7 @@ Similarly for Soar, Scheme, etc."
1151 1154
1152 (narrow-to-region obeg oend) 1155 (narrow-to-region obeg oend)
1153 (goto-char opoint) 1156 (goto-char opoint)
1154 (let ((functions comint-output-sentinel-functions)) 1157 (let ((functions comint-output-filter-functions))
1155 (while functions 1158 (while functions
1156 (funcall (car functions) string) 1159 (funcall (car functions) string)
1157 (setq functions (cdr functions)))) 1160 (setq functions (cdr functions))))
@@ -1191,7 +1194,7 @@ Does not scroll if the current line is the last line in the buffer.
1191Depends on the value of `comint-scroll-to-bottom-on-output' and 1194Depends on the value of `comint-scroll-to-bottom-on-output' and
1192`comint-scroll-show-maximum-output'. 1195`comint-scroll-show-maximum-output'.
1193 1196
1194This function should be in the list `comint-output-sentinel-functions'." 1197This function should be in the list `comint-output-filter-functions'."
1195 (let* ((selected (selected-window)) 1198 (let* ((selected (selected-window))
1196 (current (current-buffer)) 1199 (current (current-buffer))
1197 (process (get-buffer-process current)) 1200 (process (get-buffer-process current))
@@ -1968,7 +1971,7 @@ Typing SPC flushes the help buffer."
1968;;; copy-last-shell-input Use comint-previous-input/comint-next-input 1971;;; copy-last-shell-input Use comint-previous-input/comint-next-input
1969;;; 1972;;;
1970;;; SHELL-SET-DIRECTORY is gone, its functionality taken over by 1973;;; SHELL-SET-DIRECTORY is gone, its functionality taken over by
1971;;; SHELL-DIRECTORY-TRACKER, the shell mode's comint-input-sentinel-functions. 1974;;; SHELL-DIRECTORY-TRACKER, the shell mode's comint-input-filter-functions.
1972;;; Comint mode does not provide functionality equivalent to 1975;;; Comint mode does not provide functionality equivalent to
1973;;; shell-set-directory-error-hook; it is gone. 1976;;; shell-set-directory-error-hook; it is gone.
1974;;; 1977;;;
@@ -1985,7 +1988,7 @@ Typing SPC flushes the help buffer."
1985;;; necessary comint-specific local variables. Then create the 1988;;; necessary comint-specific local variables. Then create the
1986;;; foo-mode-specific local variables in foo-mode. Set the buffer's keymap to 1989;;; foo-mode-specific local variables in foo-mode. Set the buffer's keymap to
1987;;; be foo-mode-map, and its mode to be foo-mode. Set the comint-mode hooks 1990;;; be foo-mode-map, and its mode to be foo-mode. Set the comint-mode hooks
1988;;; (comint-{prompt-regexp, input-filter, input-sentinel-functions, 1991;;; (comint-{prompt-regexp, input-filter, input-filter-functions,
1989;;; get-old-input) that need to be different from the defaults. Call 1992;;; get-old-input) that need to be different from the defaults. Call
1990;;; foo-mode-hook, and you're done. Don't run the comint-mode hook yourself; 1993;;; foo-mode-hook, and you're done. Don't run the comint-mode hook yourself;
1991;;; comint-mode will take care of it. The following example, from shell.el, 1994;;; comint-mode will take care of it. The following example, from shell.el,
@@ -2009,7 +2012,7 @@ Typing SPC flushes the help buffer."
2009;;; (use-local-map shell-mode-map) 2012;;; (use-local-map shell-mode-map)
2010;;; (make-local-variable 'shell-directory-stack) 2013;;; (make-local-variable 'shell-directory-stack)
2011;;; (setq shell-directory-stack nil) 2014;;; (setq shell-directory-stack nil)
2012;;; (add-hook 'comint-input-sentinel-functions 'shell-directory-tracker) 2015;;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker)
2013;;; (run-hooks 'shell-mode-hook)) 2016;;; (run-hooks 'shell-mode-hook))
2014;;; 2017;;;
2015;;; 2018;;;