Mercurial > emacs
comparison lisp/term.el @ 10933:3057c4fd86d3
* term.el (term-eol-on-send): New variable. Use it.
(term-send-input): Don't move process-mark until after 'history stuff.
author | Per Bothner <bothner@cygnus.com> |
---|---|
date | Wed, 08 Mar 1995 00:54:20 +0000 |
parents | aec6cbccf909 |
children | 4b411b6a4e70 |
comparison
equal
deleted
inserted
replaced
10932:df11ec79623a | 10933:3057c4fd86d3 |
---|---|
146 (defvar term-scroll-with-delete nil) ;; term-scroll-with-delete is t if | 146 (defvar term-scroll-with-delete nil) ;; term-scroll-with-delete is t if |
147 ;; forward scrolling should be implemented by delete to | 147 ;; forward scrolling should be implemented by delete to |
148 ;; top-most line(s); and nil if scrolling should be implemented | 148 ;; top-most line(s); and nil if scrolling should be implemented |
149 ;; by moving term-home-marker. It is set to t iff there is a | 149 ;; by moving term-home-marker. It is set to t iff there is a |
150 ;; (non-default) scroll-region OR the alternate buffer is used. | 150 ;; (non-default) scroll-region OR the alternate buffer is used. |
151 (defvar term-pending-delete-marker) | 151 (defvar term-pending-delete-marker) ;; New user input in line mode needs to |
152 ;; be deleted, because it gets echoed by the inferior. | |
153 ;; To reduce flicker, we defer the delete until the next output. | |
152 (defvar term-old-mode-map nil) ;; Saves the old keymap when in char mode. | 154 (defvar term-old-mode-map nil) ;; Saves the old keymap when in char mode. |
153 (defvar term-old-mode-line-format) ;; Saves old mode-line-format while paging. | 155 (defvar term-old-mode-line-format) ;; Saves old mode-line-format while paging. |
154 (defvar term-pager-old-local-map nil) ;; Saves old keymap while paging. | 156 (defvar term-pager-old-local-map nil) ;; Saves old keymap while paging. |
155 (defvar term-pager-old-filter) ;; Saved process-filter while paging. | 157 (defvar term-pager-old-filter) ;; Saved process-filter while paging. |
156 | 158 |
260 "Function to actually send to PROCESS the STRING submitted by user. | 262 "Function to actually send to PROCESS the STRING submitted by user. |
261 Usually this is just 'term-simple-send, but if your mode needs to | 263 Usually this is just 'term-simple-send, but if your mode needs to |
262 massage the input string, this is your hook. This is called from | 264 massage the input string, this is your hook. This is called from |
263 the user command term-send-input. term-simple-send just sends | 265 the user command term-send-input. term-simple-send just sends |
264 the string plus a newline.") | 266 the string plus a newline.") |
267 | |
268 (defvar term-eol-on-send t | |
269 "*Non-nil means go to the end of the line before sending input. | |
270 See `term-send-input'.") | |
265 | 271 |
266 (defvar term-mode-hook '() | 272 (defvar term-mode-hook '() |
267 "Called upon entry into term-mode | 273 "Called upon entry into term-mode |
268 This is run before the process is cranked up.") | 274 This is run before the process is cranked up.") |
269 | 275 |
427 (make-local-variable 'term-input-ignoredups) | 433 (make-local-variable 'term-input-ignoredups) |
428 (make-local-variable 'term-delimiter-argument-list) | 434 (make-local-variable 'term-delimiter-argument-list) |
429 (make-local-variable 'term-input-filter-functions) | 435 (make-local-variable 'term-input-filter-functions) |
430 (make-local-variable 'term-input-filter) | 436 (make-local-variable 'term-input-filter) |
431 (make-local-variable 'term-input-sender) | 437 (make-local-variable 'term-input-sender) |
438 (make-local-variable 'term-eol-on-send) | |
432 (make-local-variable 'term-scroll-to-bottom-on-output) | 439 (make-local-variable 'term-scroll-to-bottom-on-output) |
433 (make-local-variable 'term-scroll-show-maximum-output) | 440 (make-local-variable 'term-scroll-show-maximum-output) |
434 (make-local-variable 'term-ptyp) | 441 (make-local-variable 'term-ptyp) |
435 (make-local-variable 'term-exec-hook) | 442 (make-local-variable 'term-exec-hook) |
436 (make-local-variable 'term-vertical-motion) | 443 (make-local-variable 'term-vertical-motion) |
1405 `term-input-autoexpand'. The list of function names contained in the value | 1412 `term-input-autoexpand'. The list of function names contained in the value |
1406 of `term-input-filter-functions' is called on the input before sending it. | 1413 of `term-input-filter-functions' is called on the input before sending it. |
1407 The input is entered into the input history ring, if the value of variable | 1414 The input is entered into the input history ring, if the value of variable |
1408 `term-input-filter' returns non-nil when called on the input. | 1415 `term-input-filter' returns non-nil when called on the input. |
1409 | 1416 |
1417 If variable `term-eol-on-send' is non-nil, then point is moved to the | |
1418 end of line before sending the input. | |
1419 | |
1410 The values of `term-get-old-input', `term-input-filter-functions', and | 1420 The values of `term-get-old-input', `term-input-filter-functions', and |
1411 `term-input-filter' are chosen according to the command interpreter running | 1421 `term-input-filter' are chosen according to the command interpreter running |
1412 in the buffer. E.g., | 1422 in the buffer. E.g., |
1413 | 1423 |
1414 If the interpreter is the csh, | 1424 If the interpreter is the csh, |
1430 ;; Note that the input string does not include its terminal newline. | 1440 ;; Note that the input string does not include its terminal newline. |
1431 (let ((proc (get-buffer-process (current-buffer)))) | 1441 (let ((proc (get-buffer-process (current-buffer)))) |
1432 (if (not proc) (error "Current buffer has no process") | 1442 (if (not proc) (error "Current buffer has no process") |
1433 (let* ((pmark (process-mark proc)) | 1443 (let* ((pmark (process-mark proc)) |
1434 (pmark-val (marker-position pmark)) | 1444 (pmark-val (marker-position pmark)) |
1435 (intxt (if (>= (point) pmark-val) | 1445 (input-is-new (>= (point) pmark-val)) |
1436 (progn (end-of-line) | 1446 (intxt (if input-is-new |
1437 (let ((copy (buffer-substring pmark (point)))) | 1447 (progn (if term-eol-on-send (end-of-line)) |
1438 ;; Delete, because inferior should echo. | 1448 (buffer-substring pmark (point))) |
1439 (set-marker term-pending-delete-marker | |
1440 pmark-val) | |
1441 (set-marker (process-mark proc) (point)) | |
1442 copy)) | |
1443 (funcall term-get-old-input))) | 1449 (funcall term-get-old-input))) |
1444 (input (if (not (eq term-input-autoexpand 'input)) | 1450 (input (if (not (eq term-input-autoexpand 'input)) |
1445 ;; Just whatever's already there | 1451 ;; Just whatever's already there |
1446 intxt | 1452 intxt |
1447 ;; Expand and leave it visible in buffer | 1453 ;; Expand and leave it visible in buffer |
1471 (let ((functions term-input-filter-functions)) | 1477 (let ((functions term-input-filter-functions)) |
1472 (while functions | 1478 (while functions |
1473 (funcall (car functions) (concat input "\n")) | 1479 (funcall (car functions) (concat input "\n")) |
1474 (setq functions (cdr functions)))) | 1480 (setq functions (cdr functions)))) |
1475 (setq term-input-ring-index nil) | 1481 (setq term-input-ring-index nil) |
1476 (goto-char pmark) | 1482 |
1477 ;; Update the markers before we send the input | 1483 ;; Update the markers before we send the input |
1478 ;; in case we get output amidst sending the input. | 1484 ;; in case we get output amidst sending the input. |
1479 (set-marker term-last-input-start pmark) | 1485 (set-marker term-last-input-start pmark) |
1480 (set-marker term-last-input-end (point)) | 1486 (set-marker term-last-input-end (point)) |
1487 (if input-is-new | |
1488 (progn | |
1489 ;; Set up to delete, because inferior should echo. | |
1490 (if (marker-buffer term-pending-delete-marker) | |
1491 (delete-region term-pending-delete-marker pmark)) | |
1492 (set-marker term-pending-delete-marker pmark-val) | |
1493 (set-marker (process-mark proc) (point)))) | |
1494 (goto-char pmark) | |
1481 (funcall term-input-sender proc input))))) | 1495 (funcall term-input-sender proc input))))) |
1482 | 1496 |
1483 (defun term-get-old-input-default () | 1497 (defun term-get-old-input-default () |
1484 "Default for term-get-old-input. | 1498 "Default for term-get-old-input. |
1485 Take the current line, and discard any initial text matching | 1499 Take the current line, and discard any initial text matching |