diff options
| author | Noah Friedman | 1993-03-27 08:21:02 +0000 |
|---|---|---|
| committer | Noah Friedman | 1993-03-27 08:21:02 +0000 |
| commit | 0b899bd20494bbff5ba3d5d158f074a1db9dc1cc (patch) | |
| tree | 959fa294a29a0569965994707269b0f379cec864 | |
| parent | 8db3f421f42d7a6f58bb2f453faf8b7e8e1dd9e8 (diff) | |
| download | emacs-0b899bd20494bbff5ba3d5d158f074a1db9dc1cc.tar.gz emacs-0b899bd20494bbff5ba3d5d158f074a1db9dc1cc.zip | |
moby rlogin-filter fixes
| -rw-r--r-- | lisp/rlogin.el | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/lisp/rlogin.el b/lisp/rlogin.el index bd6fc6ec3f6..eb022bbebb1 100644 --- a/lisp/rlogin.el +++ b/lisp/rlogin.el | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | ;; Maintainer: Noah Friedman <friedman@prep.ai.mit.edu> | 3 | ;; Maintainer: Noah Friedman <friedman@prep.ai.mit.edu> |
| 4 | ;; Keywords: unix, comm | 4 | ;; Keywords: unix, comm |
| 5 | 5 | ||
| 6 | ;; Copyright (C) 1992 Free Software Foundation, Inc. | 6 | ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc. |
| 7 | ;; | 7 | ;; |
| 8 | ;; This program is free software; you can redistribute it and/or modify | 8 | ;; This program is free software; you can redistribute it and/or modify |
| 9 | ;; it under the terms of the GNU General Public License as published by | 9 | ;; it under the terms of the GNU General Public License as published by |
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | 28 | ||
| 29 | ;; Support for remote login over Internet using rlogin(1). | 29 | ;; Support for remote logins using `rlogin'. |
| 30 | ;; | 30 | ;; |
| 31 | ;; Todo: add directory tracking using ange-ftp style patchnames for the cwd. | 31 | ;; Todo: add directory tracking using ange-ftp style patchnames for the cwd. |
| 32 | 32 | ||
| @@ -51,6 +51,7 @@ | |||
| 51 | (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) | 51 | (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) |
| 52 | (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D))) | 52 | (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D))) |
| 53 | 53 | ||
| 54 | ;;;###autoload | ||
| 54 | (defun rlogin (host) | 55 | (defun rlogin (host) |
| 55 | (interactive "sOpen rlogin connection to host: ") | 56 | (interactive "sOpen rlogin connection to host: ") |
| 56 | (let* ((buffer-name (concat "rlogin-" host)) | 57 | (let* ((buffer-name (concat "rlogin-" host)) |
| @@ -65,10 +66,12 @@ | |||
| 65 | (setq xargs (list host))) | 66 | (setq xargs (list host))) |
| 66 | (set-buffer (apply 'make-comint buffer-name rlogin-program nil xargs)) | 67 | (set-buffer (apply 'make-comint buffer-name rlogin-program nil xargs)) |
| 67 | (setq proc (get-process buffer-name)) | 68 | (setq proc (get-process buffer-name)) |
| 69 | (set-marker (process-mark proc) (point-min)) | ||
| 68 | (set-process-filter proc 'rlogin-filter) | 70 | (set-process-filter proc 'rlogin-filter) |
| 69 | (rlogin-mode)))) | 71 | (rlogin-mode)))) |
| 70 | (switch-to-buffer *buffer-name*))) | 72 | (switch-to-buffer *buffer-name*))) |
| 71 | 73 | ||
| 74 | ;;;###autoload | ||
| 72 | (defun rlogin-mode () | 75 | (defun rlogin-mode () |
| 73 | (interactive) | 76 | (interactive) |
| 74 | (comint-mode) | 77 | (comint-mode) |
| @@ -79,22 +82,30 @@ | |||
| 79 | (run-hooks 'rlogin-mode-hook)) | 82 | (run-hooks 'rlogin-mode-hook)) |
| 80 | 83 | ||
| 81 | (defun rlogin-filter (proc string) | 84 | (defun rlogin-filter (proc string) |
| 82 | (let ((process-buffer (process-buffer proc)) | 85 | (let ((old-buffer (current-buffer)) |
| 83 | (at-eobp (eobp))) | 86 | (old-match-data (match-data)) |
| 84 | (save-excursion | 87 | at-max-pos |
| 85 | (set-buffer process-buffer) | 88 | moving) |
| 86 | (goto-char (point-max)) | 89 | (unwind-protect |
| 87 | (let ((now (point)) | 90 | (progn |
| 88 | process-mark) | 91 | (set-buffer (process-buffer proc)) |
| 89 | (insert string) | 92 | (setq moving (= (point) (process-mark proc))) |
| 90 | (subst-char-in-region now (point) ?\C-m ?\ ) | 93 | (save-excursion |
| 91 | (subst-char-in-region now (point) ?\M-r ?\ ) | 94 | (goto-char (process-mark proc)) |
| 92 | (setq process-mark (process-mark proc)) | 95 | (save-restriction |
| 93 | (and process-mark | 96 | (let ((beg (point))) |
| 94 | (set-marker process-mark (point))))) | 97 | (insert-before-markers string) |
| 95 | (and at-eobp | 98 | (narrow-to-region beg (point)) |
| 96 | (eq process-buffer (current-buffer)) | 99 | (goto-char (point-min)) |
| 97 | (goto-char (point-max))))) | 100 | (while (search-forward "\C-m" nil t) |
| 101 | (delete-char -1)) | ||
| 102 | (setq string (buffer-substring (point-min) (point-max))) | ||
| 103 | (goto-char (point-max)))) | ||
| 104 | (set-marker (process-mark proc) (point))) | ||
| 105 | (and moving | ||
| 106 | (goto-char (process-mark proc)))) | ||
| 107 | (set-buffer old-buffer) | ||
| 108 | (store-match-data old-match-data)))) | ||
| 98 | 109 | ||
| 99 | (defun rlogin-send-Ctrl-C () | 110 | (defun rlogin-send-Ctrl-C () |
| 100 | (interactive) | 111 | (interactive) |