[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18312: PATCH: using `revert-buffer' to restart a closed telnet sessi
From: |
Emilio Lopes |
Subject: |
bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session. |
Date: |
Thu, 21 Aug 2014 17:12:51 +0200 |
The following patch allows one to use `revert-buffer' to restart a
closed telnet/rsh connection. It also defines `ssh' as an alias for
`rsh' since `remote-shell-program' is set to `ssh' by default anyway.
Regards
EmÃlio
--- lisp/ChangeLog 2014-08-21 08:40:29 +0000
+++ lisp/ChangeLog 2014-08-21 14:57:57 +0000
@@ -1,3 +1,9 @@
+2014-08-21 Emilio C. Lopes <eclig@gmx.net>
+
+ * net/telnet.el (telnet-connect-command): New variable.
+ (telnet-revert-buffer): New function.
+ (telnet-mode): use `telnet-revert-buffer' as `revert-buffer-function'.
+ (telnet, rsh): Set `telnet-connect-command' according to their
call parameters.
2014-08-21 Martin Rudalics <rudalics@gmx.at>
* window.el (window--side-window-p): New function.
=== modified file 'lisp/net/telnet.el'
--- lisp/net/telnet.el 2014-02-10 01:34:22 +0000
+++ lisp/net/telnet.el 2014-08-21 14:53:17 +0000
@@ -95,6 +95,9 @@
Should be set to the number of terminal writes telnet will make
rejecting one login and prompting again for a username and password.")
+(defvar telnet-connect-command nil
+ "Command used to start the `telnet' (or `rsh') connection.")
+
(defun telnet-interrupt-subjob ()
"Interrupt the program running through telnet on the remote host."
(interactive)
@@ -190,6 +193,13 @@
(delete-region comint-last-input-start
comint-last-input-end)))
+(defun telnet-revert-buffer (ignore-auto noconfirm)
+ (if buffer-file-name
+ (let (revert-buffer-function)
+ (revert-buffer ignore-auto noconfirm))
+ (if (or noconfirm (yes-or-no-p (format "Restart connection? ")))
+ (apply telnet-connect-command))))
+
;;;###autoload
(defun telnet (host &optional port)
"Open a network login connection to host named HOST (a string).
@@ -229,6 +239,7 @@
(if port " " "") (or port "")
"\n"))
(telnet-mode)
+ (setq-local telnet-connect-command (list 'telnet host port))
(setq comint-input-sender 'telnet-simple-send)
(setq telnet-count telnet-initial-count))))
@@ -240,6 +251,7 @@
There is a variable ``telnet-interrupt-string'' which is the character
sent to try to stop execution of a job on the remote host.
Data is sent to the remote host when RET is typed."
+ (set (make-local-variable 'revert-buffer-function) 'telnet-revert-buffer)
(set (make-local-variable 'window-point-insertion-type) t)
(set (make-local-variable 'comint-prompt-regexp) telnet-prompt-pattern)
(set (make-local-variable 'comint-use-prompt-regexp) t))
@@ -255,8 +267,11 @@
(switch-to-buffer (make-comint name remote-shell-program nil host))
(set-process-filter (get-process name) 'telnet-initial-filter)
(telnet-mode)
+ (setq-local telnet-connect-command (list 'rsh host))
(setq telnet-count -16)))
+(defalias 'ssh 'rsh)
+
(provide 'telnet)
;;; telnet.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.,
Emilio Lopes <=