GNU bug report logs - #18312
PATCH: using `revert-buffer' to restart a closed telnet session.

Previous Next

Package: emacs;

Reported by: Emilio Lopes <eclig <at> gmx.net>

Date: Thu, 21 Aug 2014 15:14:01 UTC

Severity: wishlist

Tags: fixed

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18312 in the body.
You can then email your comments to 18312 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Thu, 21 Aug 2014 15:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Emilio Lopes <eclig <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Aug 2014 15:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Emilio Lopes <eclig <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 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 <at> 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 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Tue, 23 Feb 2016 12:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Emilio Lopes <eclig <at> gmx.net>
Cc: 18312 <at> debbugs.gnu.org
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Tue, 23 Feb 2016 23:17:17 +1100
Emilio Lopes <eclig <at> 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 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Thu, 25 Feb 2016 14:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Emilio Lopes <eclig <at> gmx.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 18312 <at> debbugs.gnu.org
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Thu, 25 Feb 2016 15:38:02 +0100
[Message part 1 (text/plain, inline)]
`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 <at> gnus.org>:

> Emilio Lopes <eclig <at> 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 <at> 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
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Fri, 26 Feb 2016 05:55:02 GMT) Full text and rfc822 format available.

Message #14 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Emilio Lopes <eclig <at> gmx.net>
Cc: 18312 <at> debbugs.gnu.org
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Fri, 26 Feb 2016 16:24:17 +1030
Emilio Lopes <eclig <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Tue, 25 Jun 2019 21:41:01 GMT) Full text and rfc822 format available.

Message #17 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Emilio Lopes <eclig <at> gmx.net>
Cc: 18312 <at> debbugs.gnu.org
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Tue, 25 Jun 2019 23:40:42 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Emilio Lopes <eclig <at> 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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 21:41:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 18312 <at> debbugs.gnu.org and Emilio Lopes <eclig <at> gmx.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 21:41:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Thu, 27 Jun 2019 02:47:02 GMT) Full text and rfc822 format available.

Message #24 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 18312 <at> debbugs.gnu.org, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed telnet
 session.
Date: Wed, 26 Jun 2019 22:46:48 -0400
[[[ 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)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Thu, 27 Jun 2019 07:55:02 GMT) Full text and rfc822 format available.

Message #27 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Richard Stallman <rms <at> gnu.org>
Cc: 18312 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Thu, 27 Jun 2019 09:48:53 +0200
Richard Stallman <rms <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Thu, 27 Jun 2019 08:02:02 GMT) Full text and rfc822 format available.

Message #30 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Richard Stallman <rms <at> gnu.org>
Cc: 18312 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Thu, 27 Jun 2019 10:00:54 +0200
On Jun 26 2019, Richard Stallman <rms <at> 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 <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Thu, 27 Jun 2019 08:09:01 GMT) Full text and rfc822 format available.

Message #33 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: 18312 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Thu, 27 Jun 2019 10:08:38 +0200
>>>>> On Wed, 26 Jun 2019 22:46:48 -0400, Richard Stallman <rms <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Fri, 28 Jun 2019 02:53:01 GMT) Full text and rfc822 format available.

Message #36 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 18312 <at> debbugs.gnu.org, larsi <at> gnus.org, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed telnet
 session.
Date: Thu, 27 Jun 2019 22:52:11 -0400
[[[ 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)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Fri, 28 Jun 2019 02:53:02 GMT) Full text and rfc822 format available.

Message #39 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 18312 <at> debbugs.gnu.org, larsi <at> gnus.org, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed telnet
 session.
Date: Thu, 27 Jun 2019 22:52:12 -0400
[[[ 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)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Fri, 28 Jun 2019 07:51:02 GMT) Full text and rfc822 format available.

Message #42 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: 18312 <at> debbugs.gnu.org, larsi <at> gnus.org, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Fri, 28 Jun 2019 09:50:05 +0200
>>>>> On Thu, 27 Jun 2019 22:52:11 -0400, Richard Stallman <rms <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Fri, 28 Jun 2019 08:35:01 GMT) Full text and rfc822 format available.

Message #45 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: 18312 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> suse.de>, larsi <at> gnus.org,
 eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Fri, 28 Jun 2019 10:34:25 +0200
>>>>> On Thu, 27 Jun 2019 22:52:12 -0400, Richard Stallman <rms <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Sat, 29 Jun 2019 03:19:02 GMT) Full text and rfc822 format available.

Message #48 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 18312 <at> debbugs.gnu.org, larsi <at> gnus.org, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed telnet
 session.
Date: Fri, 28 Jun 2019 23:18:10 -0400
[[[ 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)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18312; Package emacs. (Mon, 01 Jul 2019 08:10:02 GMT) Full text and rfc822 format available.

Message #51 received at 18312 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Richard Stallman <rms <at> gnu.org>
Cc: 18312 <at> debbugs.gnu.org, larsi <at> gnus.org, eclig <at> gmx.net
Subject: Re: bug#18312: PATCH: using `revert-buffer' to restart a closed
 telnet session.
Date: Mon, 01 Jul 2019 10:09:18 +0200
On Jun 27 2019, Richard Stallman <rms <at> gnu.org> wrote:

> Why use telnet rather than ssh?

ssh only talks the ssh protocol.

Andreas.

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 29 Jul 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 266 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.