From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emilio Lopes Newsgroups: gmane.emacs.bugs Subject: bug#18312: PATCH: using `revert-buffer' to restart a closed telnet session. Date: Thu, 21 Aug 2014 17:12:51 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1408634167 7168 80.91.229.3 (21 Aug 2014 15:16:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Aug 2014 15:16:07 +0000 (UTC) To: 18312@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 21 17:16:00 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XKU43-0001ht-5y for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Aug 2014 17:14:11 +0200 Original-Received: from localhost ([::1]:32888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKU42-0003e1-Ht for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Aug 2014 11:14:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKU3y-0003ac-H9 for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 11:14:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKU3u-0001S0-9P for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 11:14:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKU3u-0001Ru-6p for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 11:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XKU3t-00052V-T8 for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 11:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Emilio Lopes Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Aug 2014 15:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18312 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.140863400419311 (code B ref -1); Thu, 21 Aug 2014 15:14:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Aug 2014 15:13:24 +0000 Original-Received: from localhost ([127.0.0.1]:49056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XKU3H-00051O-Bm for submit@debbugs.gnu.org; Thu, 21 Aug 2014 11:13:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50156) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XKU3F-00051B-Cr for submit@debbugs.gnu.org; Thu, 21 Aug 2014 11:13:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKU39-00014D-3i for submit@debbugs.gnu.org; Thu, 21 Aug 2014 11:13:16 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:53518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKU39-000149-11 for submit@debbugs.gnu.org; Thu, 21 Aug 2014 11:13:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKU37-0003GN-FB for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 11:13:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKU36-00013O-CS for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 11:13:13 -0400 Original-Received: from mail-vc0-x230.google.com ([2607:f8b0:400c:c03::230]:59485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKU36-00013C-6N for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2014 11:13:12 -0400 Original-Received: by mail-vc0-f176.google.com with SMTP id id10so10776309vcb.21 for ; Thu, 21 Aug 2014 08:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=kdBqoxYJTVHAH6xxHYZMw6wjEZDvKcgrH1ucKlMFUPI=; b=wfhHRhTZjhyPLeylE0Lj5Es7Q5qRnONhcuGXVDKjy4BT2fUkru9K6hmiDJnTnQXQJX tDJQuErKpnoDnb8jF2i6AR0kNdjcJ38muKlgROi5LemRXOq43QhSZRs8daJPe3C6WVNa n1sQwsoD+wqHpVjCFTPUqCzQrBwbJaNnZLTvFfX0KTiW/3r/Yta1sKKYy2Hb8JyRzLAY rKI4ZwDTRq/HnkKZj6byLBJgjgXn9ZdHtpt+WP+PrO2DYY8f+YOlQeJyb34Xos7mNxaP 8H0/qJPoaVG7e6cs0yHpFHMwjkbSf7gLGkshLxAO8tpZDxEXZE8UkEwq487cQ8xMcY7m RmYw== X-Received: by 10.220.110.77 with SMTP id m13mr957631vcp.35.1408633991301; Thu, 21 Aug 2014 08:13:11 -0700 (PDT) Original-Received: by 10.220.71.79 with HTTP; Thu, 21 Aug 2014 08:12:51 -0700 (PDT) X-Google-Sender-Auth: iFVeVVtP1tt8aN5Gh1sChKNPiZY X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92569 Archived-At: 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=C3=ADlio --- 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 + + * 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 * window.el (window--side-window-p): New function. =3D=3D=3D 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