unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
@ 2014-08-21 15:12 Emilio Lopes
  2016-02-23 12:17 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Emilio Lopes @ 2014-08-21 15:12 UTC (permalink / raw)
  To: 18312

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





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2014-08-21 15:12 bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session Emilio Lopes
@ 2016-02-23 12:17 ` Lars Ingebrigtsen
  2016-02-25 14:38   ` Emilio Lopes
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23 12:17 UTC (permalink / raw)
  To: Emilio Lopes; +Cc: 18312

Emilio Lopes <eclig@gmx.net> writes:

> 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.

I think this looks good.  Could you also submit changes for NEWS and the
manual (if the manual documents telnet.el, that is, I haven't checked).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2016-02-23 12:17 ` Lars Ingebrigtsen
@ 2016-02-25 14:38   ` Emilio Lopes
  2016-02-26  5:54     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Emilio Lopes @ 2016-02-25 14:38 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 18312

[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]

`telnet' is not documented in the manual.

A possible NEWS entry could be along these lines:

    ** telnet-mode

    reverting a buffer in `telnet-mode' will restart a closed connection.

Thank you!

 Emílio

2016-02-23 13:17 GMT+01:00 Lars Ingebrigtsen <larsi@gnus.org>:

> Emilio Lopes <eclig@gmx.net> writes:
>
> > 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.
>
> I think this looks good.  Could you also submit changes for NEWS and the
> manual (if the manual documents telnet.el, that is, I haven't checked).
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 2042 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2016-02-25 14:38   ` Emilio Lopes
@ 2016-02-26  5:54     ` Lars Ingebrigtsen
  2019-06-25 21:40       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-26  5:54 UTC (permalink / raw)
  To: Emilio Lopes; +Cc: 18312

Emilio Lopes <eclig@gmx.net> writes:

> `telnet' is not documented in the manual.
>
> A possible NEWS entry could be along these lines:
>
> ** telnet-mode
>
> reverting a buffer in `telnet-mode' will restart a closed connection.

Looks good.  The original patch was malformed, though, so could you
respin this all into one patch, and I'll apply it?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2016-02-26  5:54     ` Lars Ingebrigtsen
@ 2019-06-25 21:40       ` Lars Ingebrigtsen
  2019-06-27  2:46         ` Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 21:40 UTC (permalink / raw)
  To: Emilio Lopes; +Cc: 18312

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Emilio Lopes <eclig@gmx.net> writes:
>
>> `telnet' is not documented in the manual.
>>
>> A possible NEWS entry could be along these lines:
>>
>> ** telnet-mode
>>
>> reverting a buffer in `telnet-mode' will restart a closed connection.
>
> Looks good.  The original patch was malformed, though, so could you
> respin this all into one patch, and I'll apply it?

I applied it by hand and have committed it to the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-25 21:40       ` Lars Ingebrigtsen
@ 2019-06-27  2:46         ` Richard Stallman
  2019-06-27  7:48           ` Michael Albinus
                             ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Richard Stallman @ 2019-06-27  2:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 18312, eclig

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

The telnet protocol, as such, is obsolete.  Is the telnet-mode
in Emacs still useful?

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-27  2:46         ` Richard Stallman
@ 2019-06-27  7:48           ` Michael Albinus
  2019-06-27  8:00           ` Andreas Schwab
  2019-06-27  8:08           ` Robert Pluim
  2 siblings, 0 replies; 15+ messages in thread
From: Michael Albinus @ 2019-06-27  7:48 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 18312, Lars Ingebrigtsen, eclig

Richard Stallman <rms@gnu.org> writes:

Hi Richard,

> The telnet protocol, as such, is obsolete.  Is the telnet-mode
> in Emacs still useful?

I remember some old routers, which allow only telnet to connect to. So
it's still useful to have a telnet mode.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-27  2:46         ` Richard Stallman
  2019-06-27  7:48           ` Michael Albinus
@ 2019-06-27  8:00           ` Andreas Schwab
  2019-06-28  2:52             ` Richard Stallman
  2019-06-27  8:08           ` Robert Pluim
  2 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2019-06-27  8:00 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 18312, Lars Ingebrigtsen, eclig

On Jun 26 2019, Richard Stallman <rms@gnu.org> wrote:

> The telnet protocol, as such, is obsolete.  Is the telnet-mode
> in Emacs still useful?

telnet can be used also with other ports.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-27  2:46         ` Richard Stallman
  2019-06-27  7:48           ` Michael Albinus
  2019-06-27  8:00           ` Andreas Schwab
@ 2019-06-27  8:08           ` Robert Pluim
  2019-06-28  2:52             ` Richard Stallman
  2 siblings, 1 reply; 15+ messages in thread
From: Robert Pluim @ 2019-06-27  8:08 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 18312, Lars Ingebrigtsen, eclig

>>>>> On Wed, 26 Jun 2019 22:46:48 -0400, Richard Stallman <rms@gnu.org> said:

    Richard> The telnet protocol, as such, is obsolete.  Is the telnet-mode
    Richard> in Emacs still useful?

The telnet protocol may be obsolete, but like many obsolete things
itʼs still widely used and useful. telnet-mode is still useful to me.

Robert





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-27  8:08           ` Robert Pluim
@ 2019-06-28  2:52             ` Richard Stallman
  2019-06-28  7:50               ` Robert Pluim
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2019-06-28  2:52 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 18312, larsi, eclig

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > The telnet protocol may be obsolete, but like many obsolete things
  > itʼs still widely used and useful. telnet-mode is still useful to me.

Would you like to tell us more about how it is useful?
That will help us understand what to do.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-27  8:00           ` Andreas Schwab
@ 2019-06-28  2:52             ` Richard Stallman
  2019-06-28  8:34               ` Robert Pluim
  2019-07-01  8:09               ` Andreas Schwab
  0 siblings, 2 replies; 15+ messages in thread
From: Richard Stallman @ 2019-06-28  2:52 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 18312, larsi, eclig

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > telnet can be used also with other ports.

Yes, but isn't the lack of encryption a problem no matter
what port you talk to?  Why use telnet rather than ssh?

  > I remember some old routers, which allow only telnet to connect to. So
  > it's still useful to have a telnet mode.

Does anyone use Emacs's telnet mode to do that?

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-28  2:52             ` Richard Stallman
@ 2019-06-28  7:50               ` Robert Pluim
  2019-06-29  3:18                 ` Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Robert Pluim @ 2019-06-28  7:50 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 18312, larsi, eclig

>>>>> On Thu, 27 Jun 2019 22:52:11 -0400, Richard Stallman <rms@gnu.org> said:

    Richard> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
    Richard> [[[ whether defending the US Constitution against all enemies,     ]]]
    Richard> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]

    >> The telnet protocol may be obsolete, but like many obsolete things
    >> itʼs still widely used and useful. telnet-mode is still useful to me.

    Richard> Would you like to tell us more about how it is useful?
    Richard> That will help us understand what to do.

The protocol or the mode? The protocol is still used to access old
network hardware, or terminal servers which allow connections to
serial console ports. The mode is useful because it give me an emacs
buffer where normal emacs commands work, unlike term-mode; also I
basically never need any support for VT100 escape sequences in those
buffers.

Robert





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-28  2:52             ` Richard Stallman
@ 2019-06-28  8:34               ` Robert Pluim
  2019-07-01  8:09               ` Andreas Schwab
  1 sibling, 0 replies; 15+ messages in thread
From: Robert Pluim @ 2019-06-28  8:34 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 18312, Andreas Schwab, larsi, eclig

>>>>> On Thu, 27 Jun 2019 22:52:12 -0400, Richard Stallman <rms@gnu.org> said:
    Richard> Yes, but isn't the lack of encryption a problem no matter
    Richard> what port you talk to?  Why use telnet rather than ssh?

Because thatʼs the only protocol they support.

    >> I remember some old routers, which allow only telnet to connect to. So
    >> it's still useful to have a telnet mode.

    Richard> Does anyone use Emacs's telnet mode to do that?

Yes.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-28  7:50               ` Robert Pluim
@ 2019-06-29  3:18                 ` Richard Stallman
  0 siblings, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2019-06-29  3:18 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 18312, larsi, eclig

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > The protocol or the mode? The protocol is still used to access old
  > network hardware, or terminal servers which allow connections to
  > serial console ports. The mode is useful because it give me an emacs
  > buffer where normal emacs commands work, unlike term-mode; also I
  > basically never need any support for VT100 escape sequences in those
  > buffers.

Thanks for explaining.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session.
  2019-06-28  2:52             ` Richard Stallman
  2019-06-28  8:34               ` Robert Pluim
@ 2019-07-01  8:09               ` Andreas Schwab
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2019-07-01  8:09 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 18312, larsi, eclig

On Jun 27 2019, Richard Stallman <rms@gnu.org> wrote:

> Why use telnet rather than ssh?

ssh only talks the ssh protocol.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-07-01  8:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-21 15:12 bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session Emilio Lopes
2016-02-23 12:17 ` Lars Ingebrigtsen
2016-02-25 14:38   ` Emilio Lopes
2016-02-26  5:54     ` Lars Ingebrigtsen
2019-06-25 21:40       ` Lars Ingebrigtsen
2019-06-27  2:46         ` Richard Stallman
2019-06-27  7:48           ` Michael Albinus
2019-06-27  8:00           ` Andreas Schwab
2019-06-28  2:52             ` Richard Stallman
2019-06-28  8:34               ` Robert Pluim
2019-07-01  8:09               ` Andreas Schwab
2019-06-27  8:08           ` Robert Pluim
2019-06-28  2:52             ` Richard Stallman
2019-06-28  7:50               ` Robert Pluim
2019-06-29  3:18                 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).