/[emacs]/emacs/lisp/term.el
ViewVC logotype

Diff of /emacs/lisp/term.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.57 by kfstorm, Fri Sep 17 21:07:12 2004 UTC revision 1.58 by rms, Mon Sep 20 15:59:31 2004 UTC
# Line 2635  See `term-prompt-regexp'." Line 2635  See `term-prompt-regexp'."
2635  ;;; It emulates (most of the features of) a VT100/ANSI-style terminal.  ;;; It emulates (most of the features of) a VT100/ANSI-style terminal.
2636    
2637  (defun term-emulate-terminal (proc str)  (defun term-emulate-terminal (proc str)
2638    (let* ((previous-buffer (current-buffer))    (with-current-buffer (process-buffer proc)
2639           (i 0) char funny count save-point save-marker old-point temp win      (let* ((i 0) char funny count save-point save-marker old-point temp win
2640           (selected (selected-window))             (buffer-undo-list t)
2641           last-win             (selected (selected-window))
2642           (str-length (length str)))             last-win
2643      (unwind-protect             (str-length (length str)))
2644          (progn        (save-selected-window
2645            (set-buffer (process-buffer proc))  
2646            ;; Let's handle the messages. -mm
2647  ;;; Let's handle the messages. -mm  
2648            (setq str (term-handle-ansi-terminal-messages str))
2649            (setq str (term-handle-ansi-terminal-messages str))          (setq str-length (length str))
2650            (setq str-length (length str))  
2651            (if (marker-buffer term-pending-delete-marker)
2652            (if (marker-buffer term-pending-delete-marker)              (progn
2653                (progn                ;; Delete text following term-pending-delete-marker.
2654                  ;; Delete text following term-pending-delete-marker.                (delete-region term-pending-delete-marker (process-mark proc))
2655                  (delete-region term-pending-delete-marker (process-mark proc))                (set-marker term-pending-delete-marker nil)))
2656                  (set-marker term-pending-delete-marker nil)))  
2657            (if (eq (window-buffer) (current-buffer))
2658            (if (eq (window-buffer) (current-buffer))              (progn
2659                (progn                (setq term-vertical-motion (symbol-function 'vertical-motion))
2660                  (setq term-vertical-motion (symbol-function 'vertical-motion))                (term-check-size proc))
2661                  (term-check-size proc))            (setq term-vertical-motion
2662              (setq term-vertical-motion                  (symbol-function 'buffer-vertical-motion)))
2663                    (symbol-function 'buffer-vertical-motion)))  
2664            (setq save-marker (copy-marker (process-mark proc)))
2665            (setq save-marker (copy-marker (process-mark proc)))  
2666            (if (/= (point) (process-mark proc))
2667            (if (/= (point) (process-mark proc))              (progn (setq save-point (point-marker))
2668                (progn (setq save-point (point-marker))                     (goto-char (process-mark proc))))
2669                       (goto-char (process-mark proc))))  
2670            (save-restriction
2671            (save-restriction            ;; If the buffer is in line mode, and there is a partial
2672              ;; If the buffer is in line mode, and there is a partial            ;; input line, save the line (by narrowing to leave it
2673              ;; input line, save the line (by narrowing to leave it            ;; outside the restriction ) until we're done with output.
2674              ;; outside the restriction ) until we're done with output.            (if (and (> (point-max) (process-mark proc))
2675              (if (and (> (point-max) (process-mark proc))                     (term-in-line-mode))
2676                       (term-in-line-mode))                (narrow-to-region (point-min) (process-mark proc)))
2677                  (narrow-to-region (point-min) (process-mark proc)))  
2678              (if term-log-buffer
2679              (if term-log-buffer                (princ str term-log-buffer))
2680                  (princ str term-log-buffer))            (cond ((eq term-terminal-state 4) ;; Have saved pending output.
2681              (cond ((eq term-terminal-state 4) ;; Have saved pending output.                   (setq str (concat term-terminal-parameter str))
2682                     (setq str (concat term-terminal-parameter str))                   (setq term-terminal-parameter nil)
2683                     (setq term-terminal-parameter nil)                   (setq str-length (length str))
2684                     (setq str-length (length str))                   (setq term-terminal-state 0)))
2685                     (setq term-terminal-state 0)))  
2686              (while (< i str-length)
2687              (while (< i str-length)              (setq char (aref str i))
2688                (setq char (aref str i))              (cond ((< term-terminal-state 2)
2689                (cond ((< term-terminal-state 2)                     ;; Look for prefix of regular chars
2690                       ;; Look for prefix of regular chars                     (setq funny
2691                       (setq funny                           (string-match "[\r\n\000\007\033\t\b\032\016\017]"
2692                             (string-match "[\r\n\000\007\033\t\b\032\016\017]"                                         str i))
2693                                           str i))                     (if (not funny) (setq funny str-length))
2694                       (if (not funny) (setq funny str-length))                     (cond ((> funny i)
2695                       (cond ((> funny i)                            (cond ((eq term-terminal-state 1)
2696                              (cond ((eq term-terminal-state 1)                                   (term-move-columns 1)
2697                                     (term-move-columns 1)                                   (setq term-terminal-state 0)))
2698                                     (setq term-terminal-state 0)))                            (setq count (- funny i))
2699                              (setq count (- funny i))                            (setq temp (- (+ (term-horizontal-column) count)
2700                              (setq temp (- (+ (term-horizontal-column) count)                                          term-width))
2701                                            term-width))                            (cond ((<= temp 0)) ;; All count chars fit in line.
2702                              (cond ((<= temp 0)) ;; All count chars fit in line.                                  ((> count temp) ;; Some chars fit.
2703                                    ((> count temp) ;; Some chars fit.                                   ;; This iteration, handle only what fits.
2704                                     ;; This iteration, handle only what fits.                                   (setq count (- count temp))
2705                                     (setq count (- count temp))                                   (setq funny (+ count i)))
2706                                     (setq funny (+ count i)))                                  ((or (not (or term-pager-count
2707                                    ((or (not (or term-pager-count                                                term-scroll-with-delete))
2708                                                  term-scroll-with-delete))                                       (>  (term-handle-scroll 1) 0))
2709                                         (>  (term-handle-scroll 1) 0))                                   (term-adjust-current-row-cache 1)
2710                                     (term-adjust-current-row-cache 1)                                   (setq count (min count term-width))
2711                                     (setq count (min count term-width))                                   (setq funny (+ count i))
2712                                     (setq funny (+ count i))                                   (setq term-start-line-column
2713                                     (setq term-start-line-column                                         term-current-column))
2714                                           term-current-column))                                  (t ;; Doing PAGER processing.
2715                                    (t ;; Doing PAGER processing.                                   (setq count 0 funny i)
2716                                     (setq count 0 funny i)                                   (setq term-current-column nil)
2717                                     (setq term-current-column nil)                                   (setq term-start-line-column nil)))
2718                                     (setq term-start-line-column nil)))                            (setq old-point (point))
2719                              (setq old-point (point))  
2720                              ;; Insert a string, check how many columns
2721                              ;; Insert a string, check how many columns                            ;; we moved, then delete that many columns
2722                              ;; we moved, then delete that many columns                            ;; following point if not eob nor insert-mode.
2723                              ;; following point if not eob nor insert-mode.                            (let ((old-column (current-column))
2724                              (let ((old-column (current-column))                                  columns pos)
2725                                    columns pos)                              (insert (substring str i funny))
2726                                (insert (substring str i funny))                              (setq term-current-column (current-column)
2727                                (setq term-current-column (current-column)                                    columns (- term-current-column old-column))
2728                                      columns (- term-current-column old-column))                              (when (not (or (eobp) term-insert-mode))
2729                                (when (not (or (eobp) term-insert-mode))                                (setq pos (point))
2730                                  (setq pos (point))                                (term-move-columns columns)
2731                                  (term-move-columns columns)                                (delete-region pos (point))))
2732                                  (delete-region pos (point))))                            (setq term-current-column nil)
2733                              (setq term-current-column nil)  
2734                              (put-text-property old-point (point)
2735                              (put-text-property old-point (point)                                               'face term-current-face)
2736                                                 'face term-current-face)                            ;; If the last char was written in last column,
2737                              ;; If the last char was written in last column,                            ;; back up one column, but remember we did so.
2738                              ;; back up one column, but remember we did so.                            ;; Thus we emulate xterm/vt100-style line-wrapping.
2739                              ;; Thus we emulate xterm/vt100-style line-wrapping.                            (cond ((eq temp 0)
2740                              (cond ((eq temp 0)                                   (term-move-columns -1)
2741                                     (term-move-columns -1)                                   (setq term-terminal-state 1)))
2742                                     (setq term-terminal-state 1)))                            (setq i (1- funny)))
2743                              (setq i (1- funny)))                           ((and (setq term-terminal-state 0)
2744                             ((and (setq term-terminal-state 0)                                 (eq char ?\^I)) ; TAB
2745                              (eq char ?\^I)) ; TAB                            ;; FIXME:  Does not handle line wrap!
2746                              ;; FIXME:  Does not handle line wrap!                            (setq count (term-current-column))
2747                              (setq count (term-current-column))                            (setq count (+ count 8 (- (mod count 8))))
2748                              (setq count (+ count 8 (- (mod count 8))))                            (if (< (move-to-column count nil) count)
2749                              (if (< (move-to-column count nil) count)                                (term-insert-char char 1))
2750                                  (term-insert-char char 1))                            (setq term-current-column count))
2751                              (setq term-current-column count))                           ((eq char ?\r)
2752                             ((eq char ?\r)                            ;; Optimize CRLF at end of buffer:
2753                              ;; Optimize CRLF at end of buffer:                            (cond ((and (< (setq temp (1+ i)) str-length)
2754                              (cond ((and (< (setq temp (1+ i)) str-length)                                        (eq (aref str temp) ?\n)
2755                                          (eq (aref str temp) ?\n)                                        (= (point) (point-max))
2756                                          (= (point) (point-max))                                        (not (or term-pager-count
2757                                          (not (or term-pager-count                                                 term-kill-echo-list
2758                                                   term-kill-echo-list                                                 term-scroll-with-delete)))
2759                                                   term-scroll-with-delete)))                                   (insert ?\n)
2760                                     (insert ?\n)                                   (term-adjust-current-row-cache 1)
2761                                     (term-adjust-current-row-cache 1)                                   (setq term-start-line-column 0)
2762                                     (setq term-start-line-column 0)                                   (setq term-current-column 0)
2763                                     (setq term-current-column 0)                                   (setq i temp))
2764                                     (setq i temp))                                  (t ;; Not followed by LF or can't optimize:
2765                                    (t ;; Not followed by LF or can't optimize:                                   (term-vertical-motion 0)
2766                                     (term-vertical-motion 0)                                   (setq term-current-column term-start-line-column))))
2767                                     (setq term-current-column term-start-line-column))))                           ((eq char ?\n)
2768                             ((eq char ?\n)                            (if (not (and term-kill-echo-list
2769                              (if (not (and term-kill-echo-list                                          (term-check-kill-echo-list)))
2770                                            (term-check-kill-echo-list)))                                (term-down 1 t)))
2771                                  (term-down 1 t)))                           ((eq char ?\b)
2772                             ((eq char ?\b)                            (term-move-columns -1))
2773                              (term-move-columns -1))                           ((eq char ?\033) ; Escape
2774                             ((eq char ?\033) ; Escape                            (setq term-terminal-state 2))
2775                              (setq term-terminal-state 2))                           ((eq char 0))         ; NUL: Do nothing
2776                             ((eq char 0)) ; NUL: Do nothing                           ((eq char ?\016))     ; Shift Out - ignored
2777                             ((eq char ?\016)) ; Shift Out - ignored                           ((eq char ?\017))     ; Shift In - ignored
2778                             ((eq char ?\017)) ; Shift In - ignored                           ((eq char ?\^G)
2779                             ((eq char ?\^G)                            (beep t))     ; Bell
2780                              (beep t)) ; Bell                           ((eq char ?\032)
2781                             ((eq char ?\032)                            (let ((end (string-match "\r?$" str i)))
2782                              (let ((end (string-match "\r?$" str i)))                              (if end
2783                                (if end                                  (funcall term-command-hook
2784                                    (funcall term-command-hook                                           (prog1 (substring str (1+ i) end)
2785                                             (prog1 (substring str (1+ i) end)                                             (setq i (match-end 0))))
2786                                               (setq i (match-end 0))))                                (setq term-terminal-parameter
2787                                  (setq term-terminal-parameter                                      (substring str i))
2788                                        (substring str i))                                (setq term-terminal-state 4)
2789                                  (setq term-terminal-state 4)                                (setq i str-length))))
2790                                  (setq i str-length))))                           (t   ; insert char FIXME: Should never happen
2791                             (t ; insert char FIXME: Should never happen                            (term-move-columns 1)
2792                              (term-move-columns 1)                            (backward-delete-char 1)
2793                              (backward-delete-char 1)                            (insert char))))
2794                              (insert char))))                    ((eq term-terminal-state 2)     ; Seen Esc
2795                      ((eq term-terminal-state 2) ; Seen Esc                     (cond ((eq char ?\133)         ;; ?\133 = ?[
                      (cond ((eq char ?\133) ;; ?\133 = ?[  
2796    
2797  ;;; Some modifications to cope with multiple settings like ^[[01;32;43m -mm  ;;; Some modifications to cope with multiple settings like ^[[01;32;43m -mm
2798  ;;; Note that now the init value of term-terminal-previous-parameter has  ;;; Note that now the init value of term-terminal-previous-parameter has
2799  ;;; been changed to -1  ;;; been changed to -1
2800    
2801                              (make-local-variable 'term-terminal-parameter)                            (make-local-variable 'term-terminal-parameter)
2802                              (make-local-variable 'term-terminal-previous-parameter)                            (make-local-variable 'term-terminal-previous-parameter)
2803                              (make-local-variable 'term-terminal-previous-parameter-2)                            (make-local-variable 'term-terminal-previous-parameter-2)
2804                              (make-local-variable 'term-terminal-previous-parameter-3)                            (make-local-variable 'term-terminal-previous-parameter-3)
2805                              (make-local-variable 'term-terminal-previous-parameter-4)                            (make-local-variable 'term-terminal-previous-parameter-4)
2806                              (make-local-variable 'term-terminal-more-parameters)                            (make-local-variable 'term-terminal-more-parameters)
2807                              (setq term-terminal-parameter 0)                            (setq term-terminal-parameter 0)
2808                              (setq term-terminal-previous-parameter -1)                            (setq term-terminal-previous-parameter -1)
2809                              (setq term-terminal-previous-parameter-2 -1)                            (setq term-terminal-previous-parameter-2 -1)
2810                              (setq term-terminal-previous-parameter-3 -1)                            (setq term-terminal-previous-parameter-3 -1)
2811                              (setq term-terminal-previous-parameter-4 -1)                            (setq term-terminal-previous-parameter-4 -1)
2812                              (setq term-terminal-more-parameters 0)                            (setq term-terminal-more-parameters 0)
2813                              (setq term-terminal-state 3))                            (setq term-terminal-state 3))
2814                             ((eq char ?D) ;; scroll forward                           ((eq char ?D) ;; scroll forward
2815                              (term-handle-deferred-scroll)                            (term-handle-deferred-scroll)
2816                              (term-down 1 t)                            (term-down 1 t)
2817                              (setq term-terminal-state 0))                            (setq term-terminal-state 0))
2818                             ((eq char ?M) ;; scroll reversed                           ((eq char ?M) ;; scroll reversed
2819                              (term-insert-lines 1)                            (term-insert-lines 1)
2820                              (setq term-terminal-state 0))                            (setq term-terminal-state 0))
2821                             ((eq char ?7) ;; Save cursor                           ((eq char ?7) ;; Save cursor
2822                              (term-handle-deferred-scroll)                            (term-handle-deferred-scroll)
2823                              (setq term-saved-cursor                            (setq term-saved-cursor
2824                                    (cons (term-current-row)                                  (cons (term-current-row)
2825                                          (term-horizontal-column)))                                        (term-horizontal-column)))
2826                              (setq term-terminal-state 0))                            (setq term-terminal-state 0))
2827                             ((eq char ?8) ;; Restore cursor                           ((eq char ?8) ;; Restore cursor
2828                              (if term-saved-cursor                            (if term-saved-cursor
2829                                  (term-goto (car term-saved-cursor)                                (term-goto (car term-saved-cursor)
2830                                             (cdr term-saved-cursor)))                                           (cdr term-saved-cursor)))
2831                              (setq term-terminal-state 0))                            (setq term-terminal-state 0))
2832                             ((setq term-terminal-state 0))))                           ((setq term-terminal-state 0))))
2833                      ((eq term-terminal-state 3) ; Seen Esc [                    ((eq term-terminal-state 3) ; Seen Esc [
2834                       (cond ((and (>= char ?0) (<= char ?9))                     (cond ((and (>= char ?0) (<= char ?9))
2835                              (setq term-terminal-parameter                            (setq term-terminal-parameter
2836                                    (+ (* 10 term-terminal-parameter) (- char ?0))))                                  (+ (* 10 term-terminal-parameter) (- char ?0))))
2837                             ((eq char ?\;)                           ((eq char ?\;)
2838  ;;; Some modifications to cope with multiple settings like ^[[01;32;43m -mm  ;;; Some modifications to cope with multiple settings like ^[[01;32;43m -mm
2839                              (setq term-terminal-more-parameters 1)                            (setq term-terminal-more-parameters 1)
2840                              (setq term-terminal-previous-parameter-4                            (setq term-terminal-previous-parameter-4
2841                                            term-terminal-previous-parameter-3)                                  term-terminal-previous-parameter-3)
2842                              (setq term-terminal-previous-parameter-3                            (setq term-terminal-previous-parameter-3
2843                                            term-terminal-previous-parameter-2)                                  term-terminal-previous-parameter-2)
2844                              (setq term-terminal-previous-parameter-2                            (setq term-terminal-previous-parameter-2
2845                                            term-terminal-previous-parameter)                                  term-terminal-previous-parameter)
2846                              (setq term-terminal-previous-parameter                            (setq term-terminal-previous-parameter
2847                                            term-terminal-parameter)                                  term-terminal-parameter)
2848                              (setq term-terminal-parameter 0))                            (setq term-terminal-parameter 0))
2849                             ((eq char ??)) ; Ignore ?                           ((eq char ??)) ; Ignore ?
2850                             (t                           (t
2851                              (term-handle-ansi-escape proc char)                            (term-handle-ansi-escape proc char)
2852                              (setq term-terminal-more-parameters 0)                            (setq term-terminal-more-parameters 0)
2853                              (setq term-terminal-previous-parameter-4 -1)                            (setq term-terminal-previous-parameter-4 -1)
2854                              (setq term-terminal-previous-parameter-3 -1)                            (setq term-terminal-previous-parameter-3 -1)
2855                              (setq term-terminal-previous-parameter-2 -1)                            (setq term-terminal-previous-parameter-2 -1)
2856                              (setq term-terminal-previous-parameter -1)                            (setq term-terminal-previous-parameter -1)
2857                              (setq term-terminal-state 0)))))                            (setq term-terminal-state 0)))))
2858                (if (term-handling-pager)              (if (term-handling-pager)
2859                    ;; Finish stuff to get ready to handle PAGER.                  ;; Finish stuff to get ready to handle PAGER.
2860                    (progn                  (progn
2861                      (if (> (% (current-column) term-width) 0)                    (if (> (% (current-column) term-width) 0)
2862                          (setq term-terminal-parameter
2863                                (substring str i))
2864                        ;; We're at column 0.  Goto end of buffer; to compensate,
2865                        ;; prepend a ?\r for later.  This looks more consistent.
2866                        (if (zerop i)
2867                          (setq term-terminal-parameter                          (setq term-terminal-parameter
2868                                (substring str i))                                (concat "\r" (substring str i)))
2869                        ;; We're at column 0.  Goto end of buffer; to compensate,                        (setq term-terminal-parameter (substring str (1- i)))
2870                        ;; prepend a ?\r for later.  This looks more consistent.                        (aset term-terminal-parameter 0 ?\r))
2871                        (if (zerop i)                      (goto-char (point-max)))
2872                            (setq term-terminal-parameter                    (setq term-terminal-state 4)
2873                                  (concat "\r" (substring str i)))                    (make-local-variable 'term-pager-old-filter)
2874                          (setq term-terminal-parameter (substring str (1- i)))                    (setq term-pager-old-filter (process-filter proc))
2875                          (aset term-terminal-parameter 0 ?\r))                    (set-process-filter proc term-pager-filter)
2876                        (goto-char (point-max)))                    (setq i str-length)))
2877                      (setq term-terminal-state 4)              (setq i (1+ i))))
2878                      (make-local-variable 'term-pager-old-filter)  
2879                      (setq term-pager-old-filter (process-filter proc))          (if (>= (term-current-row) term-height)
2880                      (set-process-filter proc term-pager-filter)              (term-handle-deferred-scroll))
2881                      (setq i str-length)))  
2882                (setq i (1+ i))))          (set-marker (process-mark proc) (point))
2883            (if save-point
2884            (if (>= (term-current-row) term-height)              (progn (goto-char save-point)
2885                (term-handle-deferred-scroll))                     (set-marker save-point nil)))
2886    
2887            (set-marker (process-mark proc) (point))          ;; Check for a pending filename-and-line number to display.
2888            (if save-point          ;; We do this before scrolling, because we might create a new window.
2889                (progn (goto-char save-point)          (if (and term-pending-frame
2890                       (set-marker save-point nil)))                   (eq (window-buffer selected) (current-buffer)))
2891                (progn (term-display-line (car term-pending-frame)
2892            ;; Check for a pending filename-and-line number to display.                                        (cdr term-pending-frame))
2893            ;; We do this before scrolling, because we might create a new window.                     (setq term-pending-frame nil)
2894            (if (and term-pending-frame                     ;; We have created a new window, so check the window size.
2895                     (eq (window-buffer selected) (current-buffer)))                     (term-check-size proc)))
2896                (progn (term-display-line (car term-pending-frame)  
2897                                          (cdr term-pending-frame))          ;; Scroll each window displaying the buffer but (by default)
2898                       (setq term-pending-frame nil)          ;; only if the point matches the process-mark we started with.
2899                   ;; We have created a new window, so check the window size.          (setq win selected)
2900                       (term-check-size proc)))          ;; Avoid infinite loop in strange case where minibuffer window
2901            ;; is selected but not active.
2902            ;; Scroll each window displaying the buffer but (by default)          (while (window-minibuffer-p win)
2903            ;; only if the point matches the process-mark we started with.            (setq win (next-window win nil t)))
2904            (setq win selected)          (setq last-win win)
2905            ;; Avoid infinite loop in strange case where minibuffer window          (while (progn
2906            ;; is selected but not active.                   (setq win (next-window win nil t))
2907            (while (window-minibuffer-p win)                   (if (eq (window-buffer win) (process-buffer proc))
2908              (setq win (next-window win nil t)))                       (let ((scroll term-scroll-to-bottom-on-output))
2909            (setq last-win win)                         (select-window win)
2910            (while (progn                         (if (or (= (point) save-marker)
2911                     (setq win (next-window win nil t))                                 (eq scroll t) (eq scroll 'all)
2912                     (if (eq (window-buffer win) (process-buffer proc))                                 ;; Maybe user wants point to jump to the end.
2913                         (let ((scroll term-scroll-to-bottom-on-output))                                 (and (eq selected win)
2914                           (select-window win)                                      (or (eq scroll 'this) (not save-point)))
2915                           (if (or (= (point) save-marker)                                 (and (eq scroll 'others)
2916                                   (eq scroll t) (eq scroll 'all)                                      (not (eq selected win))))
2917                                   ;; Maybe user wants point to jump to the end.                             (progn
2918                                   (and (eq selected win)                               (goto-char term-home-marker)
2919                                        (or (eq scroll 'this) (not save-point)))                               (recenter 0)
2920                                   (and (eq scroll 'others)                               (goto-char (process-mark proc))
2921                                        (not (eq selected win))))                               (if (not (pos-visible-in-window-p (point) win))
2922                               (progn                                   (recenter -1))))
2923                                 (goto-char term-home-marker)                         ;; Optionally scroll so that the text
2924                                 (recenter 0)                         ;; ends at the bottom of the window.
2925                                 (goto-char (process-mark proc))                         (if (and term-scroll-show-maximum-output
2926                                 (if (not (pos-visible-in-window-p (point) win))                                  (>= (point) (process-mark proc)))
2927                                     (recenter -1))))                             (save-excursion
2928                           ;; Optionally scroll so that the text                               (goto-char (point-max))
2929                           ;; ends at the bottom of the window.                               (recenter -1)))))
2930                           (if (and term-scroll-show-maximum-output                   (not (eq win last-win))))
                                   (>= (point) (process-mark proc)))  
                              (save-excursion  
                                (goto-char (point-max))  
                                (recenter -1)))))  
                    (not (eq win last-win))))  
2931    
2932  ;;; Stolen from comint.el and adapted -mm  ;;; Stolen from comint.el and adapted -mm
2933            (if (> term-buffer-maximum-size 0)          (if (> term-buffer-maximum-size 0)
2934                    (save-excursion              (save-excursion
2935                          (goto-char (process-mark (get-buffer-process (current-buffer))))                (goto-char (process-mark (get-buffer-process (current-buffer))))
2936                          (forward-line (- term-buffer-maximum-size))                (forward-line (- term-buffer-maximum-size))
2937                          (beginning-of-line)                (beginning-of-line)
2938                          (delete-region (point-min) (point))))                (delete-region (point-min) (point))))
2939  ;;;  ;;;
2940    
2941            (set-marker save-marker nil))          (set-marker save-marker nil)))))
       ;; unwind-protect cleanup-forms follow:  
       (set-buffer previous-buffer)  
       (select-window selected))))  
2942    
2943  (defun term-handle-deferred-scroll ()  (defun term-handle-deferred-scroll ()
2944    (let ((count (- (term-current-row) term-height)))    (let ((count (- (term-current-row) term-height)))

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26