diff options
| author | Noah Friedman | 1993-05-22 05:54:38 +0000 |
|---|---|---|
| committer | Noah Friedman | 1993-05-22 05:54:38 +0000 |
| commit | 4a6ac398d4dbd01e357da0a8aae8204cb7568444 (patch) | |
| tree | eb06f981fc232bd2a331a4e99e056c20ede2c1e5 | |
| parent | 278b0a585af5fa7d78af21e6d023b7d9a0e21c4b (diff) | |
| download | emacs-4a6ac398d4dbd01e357da0a8aae8204cb7568444.tar.gz emacs-4a6ac398d4dbd01e357da0a8aae8204cb7568444.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/rlogin.el | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/lisp/rlogin.el b/lisp/rlogin.el index 79449f50cd8..1d9f077afef 100644 --- a/lisp/rlogin.el +++ b/lisp/rlogin.el | |||
| @@ -165,27 +165,35 @@ If `rlogin-mode-hook' is set, run it." | |||
| 165 | 165 | ||
| 166 | 166 | ||
| 167 | (defun rlogin-filter (proc string) | 167 | (defun rlogin-filter (proc string) |
| 168 | (save-excursion | 168 | (let (proc-mark region-begin window) |
| 169 | (set-buffer (process-buffer proc)) | 169 | (save-excursion |
| 170 | (let ((proc-mark (process-mark proc)) | 170 | (set-buffer (process-buffer proc)) |
| 171 | (region-begin (point))) | 171 | (setq proc-mark (process-mark proc) |
| 172 | region-begin (point) | ||
| 173 | ;; If process mark is at window start, insert-before-markers | ||
| 174 | ;; will insert text off-window since it's also inserting before | ||
| 175 | ;; the start window mark. Make sure we can see the most recent | ||
| 176 | ;; text. (note: it's a buglet that this isn't necessary if | ||
| 177 | ;; scroll-step is 0, but that works to our advantage since it | ||
| 178 | ;; makes the filter a little faster.) | ||
| 179 | window (and (/= 0 scroll-step) | ||
| 180 | (= proc-mark (window-start)) | ||
| 181 | (get-buffer-window (current-buffer)))) | ||
| 172 | (goto-char proc-mark) | 182 | (goto-char proc-mark) |
| 173 | (insert-before-markers string) | 183 | (insert-before-markers string) |
| 174 | (goto-char region-begin) | 184 | (goto-char region-begin) |
| 175 | (while (search-forward "\C-m" proc-mark t) | 185 | ;; I think something fishy is going on with save-excursion and |
| 176 | (delete-char -1)))) | 186 | ;; search-forward. If you don't make search-forward move to the end |
| 177 | ;; Kludgy workaround for scroll-step bug in emacs. If point is at the | 187 | ;; of the search region when it's done, then if the user switches |
| 178 | ;; top of the window, scroll step is nonzero, and you call | 188 | ;; buffers back and forth, it leaves point sitting behind the |
| 179 | ;; insert-before-markers, the text is inserted off-screen. If | 189 | ;; process-mark, so that text inserted later goes off-screen. |
| 180 | ;; scroll-step is 0, this doesn't happen. | 190 | (while (search-forward "\C-m" proc-mark 'goto-end) |
| 181 | (and (/= scroll-step 0) | 191 | (delete-char -1))) |
| 182 | (eq (process-buffer proc) (window-buffer (selected-window))) | 192 | ;; Frob window-start outside of save-excursion so it works whether the |
| 183 | (eq (point) (window-start)) | 193 | ;; current buffer is the process buffer or not. |
| 184 | (set-window-start (selected-window) | 194 | (and window |
| 185 | (save-excursion | 195 | (>= (window-start window) region-begin) |
| 186 | (beginning-of-line) | 196 | (set-window-start window region-begin 'noforce))) |
| 187 | (point)) | ||
| 188 | 'noforce)) | ||
| 189 | (and rlogin-password-paranoia | 197 | (and rlogin-password-paranoia |
| 190 | (string= "Password:" string) | 198 | (string= "Password:" string) |
| 191 | (rlogin-password proc))) | 199 | (rlogin-password proc))) |