comparison lisp/term.el @ 24936:10d20f341dee

(term-emulate-terminal): Avoid infinite loop in strange case where minibuffer window is selected but not active.
author Richard M. Stallman <rms@gnu.org>
date Fri, 09 Jul 1999 02:32:02 +0000
parents 9a52ffb7bfb2
children bfa093996074
comparison
equal deleted inserted replaced
24935:26cd0ba03116 24936:10d20f341dee
2698 2698
2699 (defun term-emulate-terminal (proc str) 2699 (defun term-emulate-terminal (proc str)
2700 (let* ((previous-buffer (current-buffer)) 2700 (let* ((previous-buffer (current-buffer))
2701 (i 0) char funny count save-point save-marker old-point temp win 2701 (i 0) char funny count save-point save-marker old-point temp win
2702 (selected (selected-window)) 2702 (selected (selected-window))
2703 last-win
2703 (str-length (length str))) 2704 (str-length (length str)))
2704 (unwind-protect 2705 (unwind-protect
2705 (progn 2706 (progn
2706 (set-buffer (process-buffer proc)) 2707 (set-buffer (process-buffer proc))
2707 2708
2955 (term-check-size proc))) 2956 (term-check-size proc)))
2956 2957
2957 ;; Scroll each window displaying the buffer but (by default) 2958 ;; Scroll each window displaying the buffer but (by default)
2958 ;; only if the point matches the process-mark we started with. 2959 ;; only if the point matches the process-mark we started with.
2959 (setq win selected) 2960 (setq win selected)
2961 ;; Avoid infinite loop in strange case where minibuffer window
2962 ;; is selected but not active.
2963 (while (window-minibuffer-p win)
2964 (setq win (next-window win nil t)))
2965 (setq last-win win)
2960 (while (progn 2966 (while (progn
2961 (setq win (next-window win nil t)) 2967 (setq win (next-window win nil t))
2962 (if (eq (window-buffer win) (process-buffer proc)) 2968 (if (eq (window-buffer win) (process-buffer proc))
2963 (let ((scroll term-scroll-to-bottom-on-output)) 2969 (let ((scroll term-scroll-to-bottom-on-output))
2964 (select-window win) 2970 (select-window win)
2980 (if (and term-scroll-show-maximum-output 2986 (if (and term-scroll-show-maximum-output
2981 (>= (point) (process-mark proc))) 2987 (>= (point) (process-mark proc)))
2982 (save-excursion 2988 (save-excursion
2983 (goto-char (point-max)) 2989 (goto-char (point-max))
2984 (recenter -1))))) 2990 (recenter -1)))))
2985 (not (eq win selected)))) 2991 (not (eq win last-win))))
2986 2992
2987 ;;; Stolen from comint.el and adapted -mm 2993 ;;; Stolen from comint.el and adapted -mm
2988 (if (> term-buffer-maximum-size 0) 2994 (if (> term-buffer-maximum-size 0)
2989 (save-excursion 2995 (save-excursion
2990 (goto-char (process-mark (get-buffer-process (current-buffer)))) 2996 (goto-char (process-mark (get-buffer-process (current-buffer))))