aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Bothner1995-03-08 00:54:20 +0000
committerPer Bothner1995-03-08 00:54:20 +0000
commit624f44f19fd6d7ef2c8c58ae709addd712d47ecc (patch)
treec653226f7956f7079bdc53fe4b0cc3a529740b9b
parenta9f16aa9867d71f14ccda18fe83c8b6e7ebabec9 (diff)
downloademacs-624f44f19fd6d7ef2c8c58ae709addd712d47ecc.tar.gz
emacs-624f44f19fd6d7ef2c8c58ae709addd712d47ecc.zip
* term.el (term-eol-on-send): New variable. Use it.
(term-send-input): Don't move process-mark until after 'history stuff.
-rw-r--r--lisp/term.el34
1 files changed, 24 insertions, 10 deletions
diff --git a/lisp/term.el b/lisp/term.el
index 56cac72910e..268f673a8cf 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -148,7 +148,9 @@
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.
@@ -263,6 +265,10 @@ massage the input string, this is your hook. This is called from
263the user command term-send-input. term-simple-send just sends 265the user command term-send-input. term-simple-send just sends
264the string plus a newline.") 266the string plus a newline.")
265 267
268(defvar term-eol-on-send t
269 "*Non-nil means go to the end of the line before sending input.
270See `term-send-input'.")
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
268This is run before the process is cranked up.") 274This is run before the process is cranked up.")
@@ -429,6 +435,7 @@ Entry to this mode runs the hooks on term-mode-hook"
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)
@@ -1407,6 +1414,9 @@ of `term-input-filter-functions' is called on the input before sending it.
1407The input is entered into the input history ring, if the value of variable 1414The 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
1417If variable `term-eol-on-send' is non-nil, then point is moved to the
1418end of line before sending the input.
1419
1410The values of `term-get-old-input', `term-input-filter-functions', and 1420The 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
1412in the buffer. E.g., 1422in the buffer. E.g.,
@@ -1432,14 +1442,10 @@ Similarly for Soar, Scheme, etc."
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
@@ -1473,11 +1479,19 @@ Similarly for Soar, Scheme, etc."
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 ()