diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-08-03 04:09:19 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-08-03 04:09:19 +0000 |
commit | f0405d38c44fb422c263dbc9c5a2847f94009f92 (patch) | |
tree | 73a1773dbd394e5eaea964fe538c71d1b8719b32 /lisp/telnet.el | |
parent | 63a2b8b59b8822474d4d90f44be1e272365bf5cb (diff) | |
download | emacs-f0405d38c44fb422c263dbc9c5a2847f94009f92.tar.gz |
(telnet): If we already have a telnet to HOST, just switch buffers.
Diffstat (limited to 'lisp/telnet.el')
-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.") comint-last-input-end))) ;;;###autoload -(defun telnet (arg) +(defun telnet (host) "Open a network login connection to host named HOST (a string). Communication with HOST is recorded in a buffer *HOST-telnet*. Normally input is edited in Emacs and sent a line at a time." (interactive "sOpen telnet connection to host: ") - (let ((name (concat arg "-telnet" ))) - (switch-to-buffer (make-comint name "telnet")) - (set-process-filter (get-process name) 'telnet-initial-filter) - ;; Don't send the `open' cmd till telnet is ready for it. - (accept-process-output (get-process name)) - (erase-buffer) - (send-string name (concat "open " arg "\n")) - (telnet-mode) - (setq comint-input-sender 'telnet-simple-send) - (setq telnet-count telnet-initial-count))) + (let* ((name (concat host "-telnet" )) + (buffer (get-buffer (concat "*" name "*")))) + (if (and buffer (get-buffer-process buffer)) + (switch-to-buffer (concat "*" name "*")) + (switch-to-buffer (make-comint name "telnet")) + (set-process-filter (get-process name) 'telnet-initial-filter) + ;; Don't send the `open' cmd till telnet is ready for it. + (accept-process-output (get-process name)) + (erase-buffer) + (send-string name (concat "open " host "\n")) + (telnet-mode) + (setq comint-input-sender 'telnet-simple-send) + (setq telnet-count telnet-initial-count)))) (defun telnet-mode () "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. (run-hooks 'telnet-mode-hook)) ;;;###autoload -(defun rsh (arg) +(defun rsh (host) "Open a network login connection to host named HOST (a string). Communication with HOST is recorded in a buffer *HOST-rsh*. Normally input is edited in Emacs and sent a line at a time." (interactive "sOpen rsh connection to host: ") (require 'shell) - (let ((name (concat arg "-rsh" ))) + (let ((name (concat host "-rsh" ))) (switch-to-buffer (make-comint name "rsh")) (set-process-filter (get-process name) 'telnet-initial-filter) (telnet-mode) |