Sync to HEAD
[bpt/emacs.git] / lisp / net / telnet.el
index be4753c..dac6f22 100644 (file)
@@ -30,7 +30,7 @@
 ;; sessions are supported.
 ;;
 ;; Normally, input is sent to the remote telnet/rsh line-by-line, as you
-;; type RET or LFD.  C-c C-c sends a C-c to the remote immediately; 
+;; type RET or LFD.  C-c C-c sends a C-c to the remote immediately;
 ;; C-c C-z sends C-z immediately.  C-c C-q followed by any character
 ;; sends that character immediately.
 ;;
@@ -89,8 +89,8 @@ Should be set to the number of terminal writes telnet will make
 rejecting one login and prompting again for a username and password.")
 
 (defun telnet-interrupt-subjob ()
-  (interactive)
   "Interrupt the program running through telnet on the remote host."
+  (interactive)
   (send-string nil telnet-interrupt-string))
 
 (defun telnet-c-z ()
@@ -112,7 +112,7 @@ rejecting one login and prompting again for a username and password.")
   (define-key telnet-mode-map "\C-m" 'telnet-send-input)
 ;  (define-key telnet-mode-map "\C-j" 'telnet-send-input)
   (define-key telnet-mode-map "\C-c\C-q" 'send-process-next-char)
-  (define-key telnet-mode-map "\C-c\C-c" 'telnet-interrupt-subjob) 
+  (define-key telnet-mode-map "\C-c\C-c" 'telnet-interrupt-subjob)
   (define-key telnet-mode-map "\C-c\C-z" 'telnet-c-z))
 
 ;;maybe should have a flag for when have found type
@@ -154,7 +154,10 @@ rejecting one login and prompting again for a username and password.")
 ;; instead of "\n".
 (defun telnet-simple-send (proc string)
   (comint-send-string proc string)
-  (comint-send-string proc telnet-new-line))
+  (if comint-input-sender-no-newline
+      (if (not (string-equal string ""))
+         (process-send-eof))
+    (comint-send-string proc telnet-new-line)))
 
 (defun telnet-filter (proc string)
   (save-excursion
@@ -211,7 +214,7 @@ Normally input is edited in Emacs and sent a line at a time."
         process)
     (if (and buffer (get-buffer-process buffer))
        (pop-to-buffer (concat "*" name "*"))
-      (pop-to-buffer 
+      (pop-to-buffer
        (apply 'make-comint name telnet-program nil telnet-options))
       (setq process (get-buffer-process (current-buffer)))
       (set-process-filter process 'telnet-initial-filter)
@@ -259,4 +262,5 @@ Normally input is edited in Emacs and sent a line at a time."
 
 (provide 'telnet)
 
+;;; arch-tag: 98218821-d04a-48b6-9058-57d0d4677a56
 ;;; telnet.el ends here