Mercurial > emacs
comparison lisp/comint.el @ 2539:577c77cfd199
*** empty log message ***
author | Noah Friedman <friedman@splode.com> |
---|---|
date | Fri, 16 Apr 1993 13:06:01 +0000 |
parents | 10509afe2588 |
children | 308da27928f2 |
comparison
equal
deleted
inserted
replaced
2538:78420d74d47f | 2539:577c77cfd199 |
---|---|
119 ;;; comint-get-old-input - function Hooks for specific | 119 ;;; comint-get-old-input - function Hooks for specific |
120 ;;; comint-input-sentinel - function process-in-a-buffer | 120 ;;; comint-input-sentinel - function process-in-a-buffer |
121 ;;; comint-input-filter - function modes. | 121 ;;; comint-input-filter - function modes. |
122 ;;; comint-input-send - function | 122 ;;; comint-input-send - function |
123 ;;; comint-eol-on-send - boolean | 123 ;;; comint-eol-on-send - boolean |
124 ;;; comint-process-echoes - boolean | |
124 | 125 |
125 (defvar comint-prompt-regexp "^" | 126 (defvar comint-prompt-regexp "^" |
126 "Regexp to recognise prompts in the inferior process. | 127 "Regexp to recognise prompts in the inferior process. |
127 Defaults to \"^\", the null string at BOL. | 128 Defaults to \"^\", the null string at BOL. |
128 | 129 |
136 | 137 |
137 This is a good thing to set in mode hooks.") | 138 This is a good thing to set in mode hooks.") |
138 | 139 |
139 (defvar comint-input-ring-size 30 | 140 (defvar comint-input-ring-size 30 |
140 "Size of input history ring.") | 141 "Size of input history ring.") |
142 | |
143 (defvar comint-process-echoes nil | |
144 "*If non-`nil', assume that the subprocess echoes any input. | |
145 If so, delete one copy of the input so that only one copy eventually | |
146 appears in the buffer. | |
147 | |
148 This variable is buffer-local.") | |
141 | 149 |
142 ;;; Here are the per-interpreter hooks. | 150 ;;; Here are the per-interpreter hooks. |
143 (defvar comint-get-old-input (function comint-get-old-input-default) | 151 (defvar comint-get-old-input (function comint-get-old-input-default) |
144 "Function that submits old text in comint mode. | 152 "Function that submits old text in comint mode. |
145 This function is called when return is typed while the point is in old text. | 153 This function is called when return is typed while the point is in old text. |
245 (make-local-variable 'comint-input-filter) | 253 (make-local-variable 'comint-input-filter) |
246 (make-local-variable 'comint-input-sender) | 254 (make-local-variable 'comint-input-sender) |
247 (make-local-variable 'comint-eol-on-send) | 255 (make-local-variable 'comint-eol-on-send) |
248 (make-local-variable 'comint-ptyp) | 256 (make-local-variable 'comint-ptyp) |
249 (make-local-variable 'comint-exec-hook) | 257 (make-local-variable 'comint-exec-hook) |
258 (make-local-variable 'comint-process-echoes) | |
250 (run-hooks 'comint-mode-hook) | 259 (run-hooks 'comint-mode-hook) |
251 (or comint-input-ring | 260 (or comint-input-ring |
252 (setq comint-input-ring (make-ring comint-input-ring-size)))) | 261 (setq comint-input-ring (make-ring comint-input-ring-size)))) |
253 | 262 |
254 (if comint-mode-map | 263 (if comint-mode-map |
561 | 570 |
562 (defun comint-send-input () | 571 (defun comint-send-input () |
563 "Send input to process. | 572 "Send input to process. |
564 After the process output mark, sends all text from the process mark to | 573 After the process output mark, sends all text from the process mark to |
565 point as input to the process. Before the process output mark, calls value | 574 point as input to the process. Before the process output mark, calls value |
566 of variable comint-get-old-input to retrieve old input, copies it to the | 575 of variable `comint-get-old-input' to retrieve old input, copies it to the |
567 process mark, and sends it. A terminal newline is also inserted into the | 576 process mark, and sends it. If variable `comint-process-echoes' is `nil', |
568 buffer and sent to the process. In either case, value of variable | 577 a terminal newline is also inserted into the buffer and sent to the process |
569 comint-input-sentinel is called on the input before sending it. The input | 578 (if it is non-`nil', all text from the process mark to point is deleted, |
570 is entered into the input history ring, if the value of variable | 579 since it is assumed the remote process will re-echo it). The value of |
571 comint-input-filter returns non-nil when called on the input. | 580 variable `comint-input-sentinel' is called on the input before sending it. |
572 | 581 The input is entered into the input history ring, if the value of variable |
573 If variable comint-eol-on-send is non-nil, then point is moved to the end of | 582 `comint-input-filter' returns non-`nil' when called on the input. |
574 line before sending the input. | 583 |
575 | 584 If variable `comint-eol-on-send' is non-`nil', then point is moved to the |
576 comint-get-old-input, comint-input-sentinel, and comint-input-filter are chosen | 585 end of line before sending the input. |
577 according to the command interpreter running in the buffer. E.g., | 586 |
587 `comint-get-old-input', `comint-input-sentinel', and `comint-input-filter' | |
588 are chosen according to the command interpreter running in the buffer. E.g., | |
578 If the interpreter is the csh, | 589 If the interpreter is the csh, |
579 comint-get-old-input is the default: take the current line, discard any | 590 comint-get-old-input is the default: take the current line, discard any |
580 initial string matching regexp comint-prompt-regexp. | 591 initial string matching regexp comint-prompt-regexp. |
581 comint-input-sentinel monitors input for \"cd\", \"pushd\", and \"popd\" | 592 comint-input-sentinel monitors input for \"cd\", \"pushd\", and \"popd\" |
582 commands. When it sees one, it cd's the buffer. | 593 commands. When it sees one, it cd's the buffer. |
601 (buffer-substring pmark (point))) | 612 (buffer-substring pmark (point))) |
602 (let ((copy (funcall comint-get-old-input))) | 613 (let ((copy (funcall comint-get-old-input))) |
603 (goto-char pmark) | 614 (goto-char pmark) |
604 (insert copy) | 615 (insert copy) |
605 copy)))) | 616 copy)))) |
606 (insert ?\n) | 617 (if comint-process-echoes |
618 (delete-region pmark (point)) | |
619 (insert ?\n)) | |
607 (if (funcall comint-input-filter input) | 620 (if (funcall comint-input-filter input) |
608 (ring-insert comint-input-ring input)) | 621 (ring-insert comint-input-ring input)) |
609 (funcall comint-input-sentinel input) | 622 (funcall comint-input-sentinel input) |
610 (funcall comint-input-sender proc input) | 623 (funcall comint-input-sender proc input) |
611 (setq comint-input-ring-index nil) | 624 (setq comint-input-ring-index nil) |