diff options
| author | Richard M. Stallman | 1993-08-03 04:09:19 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-03 04:09:19 +0000 |
| commit | 901249a345bc168eb8223005055d77f848c1ef14 (patch) | |
| tree | 95953be8307dec459c2dc36357cad192950968ae | |
| parent | a569dbc32fb4a7aeaa8b37a22122f63bea4d2be4 (diff) | |
| download | emacs-901249a345bc168eb8223005055d77f848c1ef14.tar.gz emacs-901249a345bc168eb8223005055d77f848c1ef14.zip | |
(telnet): If we already have a telnet to HOST, just switch buffers.
| -rw-r--r-- | lisp/telnet.el | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lisp/telnet.el b/lisp/telnet.el index fec7f9c976e..4422c17032d 100644 --- a/lisp/telnet.el +++ b/lisp/telnet.el | |||
| @@ -171,21 +171,24 @@ rejecting one login and prompting for the again for a username and password.") | |||
| 171 | comint-last-input-end))) | 171 | comint-last-input-end))) |
| 172 | 172 | ||
| 173 | ;;;###autoload | 173 | ;;;###autoload |
| 174 | (defun telnet (arg) | 174 | (defun telnet (host) |
| 175 | "Open a network login connection to host named HOST (a string). | 175 | "Open a network login connection to host named HOST (a string). |
| 176 | Communication with HOST is recorded in a buffer *HOST-telnet*. | 176 | Communication with HOST is recorded in a buffer *HOST-telnet*. |
| 177 | Normally input is edited in Emacs and sent a line at a time." | 177 | Normally input is edited in Emacs and sent a line at a time." |
| 178 | (interactive "sOpen telnet connection to host: ") | 178 | (interactive "sOpen telnet connection to host: ") |
| 179 | (let ((name (concat arg "-telnet" ))) | 179 | (let* ((name (concat host "-telnet" )) |
| 180 | (switch-to-buffer (make-comint name "telnet")) | 180 | (buffer (get-buffer (concat "*" name "*")))) |
| 181 | (set-process-filter (get-process name) 'telnet-initial-filter) | 181 | (if (and buffer (get-buffer-process buffer)) |
| 182 | ;; Don't send the `open' cmd till telnet is ready for it. | 182 | (switch-to-buffer (concat "*" name "*")) |
| 183 | (accept-process-output (get-process name)) | 183 | (switch-to-buffer (make-comint name "telnet")) |
| 184 | (erase-buffer) | 184 | (set-process-filter (get-process name) 'telnet-initial-filter) |
| 185 | (send-string name (concat "open " arg "\n")) | 185 | ;; Don't send the `open' cmd till telnet is ready for it. |
| 186 | (telnet-mode) | 186 | (accept-process-output (get-process name)) |
| 187 | (setq comint-input-sender 'telnet-simple-send) | 187 | (erase-buffer) |
| 188 | (setq telnet-count telnet-initial-count))) | 188 | (send-string name (concat "open " host "\n")) |
| 189 | (telnet-mode) | ||
| 190 | (setq comint-input-sender 'telnet-simple-send) | ||
| 191 | (setq telnet-count telnet-initial-count)))) | ||
| 189 | 192 | ||
| 190 | (defun telnet-mode () | 193 | (defun telnet-mode () |
| 191 | "This mode is for using telnet (or rsh) from a buffer to another host. | 194 | "This mode is for using telnet (or rsh) from a buffer to another host. |
| @@ -205,13 +208,13 @@ Data is sent to the remote host when RET is typed. | |||
| 205 | (run-hooks 'telnet-mode-hook)) | 208 | (run-hooks 'telnet-mode-hook)) |
| 206 | 209 | ||
| 207 | ;;;###autoload | 210 | ;;;###autoload |
| 208 | (defun rsh (arg) | 211 | (defun rsh (host) |
| 209 | "Open a network login connection to host named HOST (a string). | 212 | "Open a network login connection to host named HOST (a string). |
| 210 | Communication with HOST is recorded in a buffer *HOST-rsh*. | 213 | Communication with HOST is recorded in a buffer *HOST-rsh*. |
| 211 | Normally input is edited in Emacs and sent a line at a time." | 214 | Normally input is edited in Emacs and sent a line at a time." |
| 212 | (interactive "sOpen rsh connection to host: ") | 215 | (interactive "sOpen rsh connection to host: ") |
| 213 | (require 'shell) | 216 | (require 'shell) |
| 214 | (let ((name (concat arg "-rsh" ))) | 217 | (let ((name (concat host "-rsh" ))) |
| 215 | (switch-to-buffer (make-comint name "rsh")) | 218 | (switch-to-buffer (make-comint name "rsh")) |
| 216 | (set-process-filter (get-process name) 'telnet-initial-filter) | 219 | (set-process-filter (get-process name) 'telnet-initial-filter) |
| 217 | (telnet-mode) | 220 | (telnet-mode) |