comparison lisp/rlogin.el @ 5207:e4ebdcbb3ffc

(rlogin-filter): initialize `region-begin' to (marker-position proc-mark), not just (point), whatever random value that may be. Put bindings for `proc-mark', `region-begin', and `window' in separate setq forms. In determining whether window-start readjustment is needed, do not examine scroll-step; it is irrelevant.
author Noah Friedman <friedman@splode.com>
date Wed, 01 Dec 1993 09:57:04 +0000
parents 20154e6389eb
children 203a78f3f2e4
comparison
equal deleted inserted replaced
5206:810820d03e24 5207:e4ebdcbb3ffc
21 ;; Inc.; 675 Massachusetts Avenue.; Cambridge, MA 02139, USA. 21 ;; Inc.; 675 Massachusetts Avenue.; Cambridge, MA 02139, USA.
22 22
23 ;;; Commentary: 23 ;;; Commentary:
24 24
25 ;; Support for remote logins using `rlogin'. 25 ;; Support for remote logins using `rlogin'.
26 ;; $Id: rlogin.el,v 1.12 1993/10/18 07:05:11 friedman Exp rms $ 26 ;; $Id: rlogin.el,v 1.13 1993/10/22 17:12:54 rms Exp friedman $
27 27
28 ;;; Todo: 28 ;;; Todo:
29 29
30 ;; Make this mode deal with comint-last-input-end properly. 30 ;; Make this mode deal with comint-last-input-end properly.
31 31
172 172
173 (defun rlogin-filter (proc string) 173 (defun rlogin-filter (proc string)
174 (let (proc-mark region-begin window) 174 (let (proc-mark region-begin window)
175 (save-excursion 175 (save-excursion
176 (set-buffer (process-buffer proc)) 176 (set-buffer (process-buffer proc))
177 (setq proc-mark (process-mark proc) 177 (setq proc-mark (process-mark proc))
178 region-begin (point) 178 (setq region-begin (marker-position proc-mark))
179 ;; If process mark is at window start, insert-before-markers 179 ;; If process mark is at window start, insert-before-markers will
180 ;; will insert text off-window since it's also inserting before 180 ;; insert text off-window since it's also inserting before the start
181 ;; the start window mark. Make sure we can see the most recent 181 ;; window mark. Make sure we can see the most recent text.
182 ;; text. (note: it's a buglet that this isn't necessary if 182 (setq window (and (= proc-mark (window-start))
183 ;; scroll-step is 0, but that works to our advantage since it
184 ;; makes the filter a little faster.)
185 window (and (/= 0 scroll-step)
186 (= proc-mark (window-start))
187 (get-buffer-window (current-buffer)))) 183 (get-buffer-window (current-buffer))))
188 (goto-char proc-mark) 184 (goto-char proc-mark)
189 (insert-before-markers string) 185 (insert-before-markers string)
190 (goto-char region-begin) 186 (goto-char region-begin)
191 ;; I think something fishy is going on with save-excursion and
192 ;; search-forward. If you don't make search-forward move to the end
193 ;; of the search region when it's done, then if the user switches
194 ;; buffers back and forth, it leaves point sitting behind the
195 ;; process-mark, so that text inserted later goes off-screen.
196 (while (search-forward "\C-m" proc-mark 'goto-end) 187 (while (search-forward "\C-m" proc-mark 'goto-end)
197 (delete-char -1))) 188 (delete-char -1)))
198 ;; Frob window-start outside of save-excursion so it works whether the 189 ;; Frob window-start outside of save-excursion so it works whether the
199 ;; current buffer is the process buffer or not. 190 ;; current buffer is the process buffer or not.
200 (and window 191 (and window