From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Q on using shell mode remotely Date: Mon, 31 Jul 2006 09:35:11 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154363793 4207 80.91.229.2 (31 Jul 2006 16:36:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 31 Jul 2006 16:36:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 31 18:36:24 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G7akK-0004Q9-Md for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Jul 2006 18:36:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7akJ-0007Nv-WC for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Jul 2006 12:36:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G7ak4-0007Lt-5z for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 12:35:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G7ak2-0007H7-9Y for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 12:35:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7ak2-0007Gx-4y for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 12:35:42 -0400 Original-Received: from [148.87.113.118] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1G7amj-0002D7-A6 for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 12:38:29 -0400 Original-Received: from rcsmt251.oracle.com (rcsmt251.oracle.com [148.87.90.196]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id k6VBBmYF028454 for ; Mon, 31 Jul 2006 10:35:38 -0600 Original-Received: from dradams-lap.us.oracle.com by rcsmt250.oracle.com with ESMTP id 1672961431154363712; Mon, 31 Jul 2006 10:35:12 -0600 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 In-Reply-To: X-Whitelist: TRUE X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:36390 Drew Adams wrote: > My question is: can you use shell mode remotely? ... > If so, how? M-x telnet Love it! Thanks, Kevin, once again! This responds perfectly to what I was asking for. (I've used telnet a lot, of course, but I didn't know that Emacs had a telnet mode.) This will save me a lot of time futzing around with Tarantella and VNC. I'm embarassed that I didn't find this on my own, especially since it is mentioned in the Emacs manual, at least as far back as Emacs 20. RTFM Drew! Thx. I do have another question now, for anyone: When I use M-x telnet, I get a prompt that looks like this: > 8:34am I have some Emacs-Lisp code that recognizes the shell prompt, in order to let you complete and cycle among past shell inputs. I use `comint-prompt-regexp' to recognize the prompt; I subtract the prompt from an input line to get the actual command used. In plain (local) shell mode on Windows, this works fine; there, the prompt I see is this: "> ". In telnet mode, however, the time of day interferes. It is not actually part of the prompt as understood by Emacs (comint mode) - that is, it doesn't match the default value of `comint-prompt-regexp'. For both shell and telnet modes, this is the value of `comint-prompt-regexp': "^[^#$%>\n]*[#$%>] *" On the remote machine, I do have a right-side prompt variable ($rprompt) set to add the time at the *right* side of the screen. I use csh as the remote-machine shell, and this is my $prompt: "%B%.01%b %h:" This is my $rprompt (it is this that prints the time of day at the right): "%@" Through telnet, the time appears next to the left prompt (i.e. at the left) - I guess there is no notion of right-side prompt, but it still picks up $rprompt and concatenates it to $prompt. Naturally, it is not picked up by `comint-prompt-regexp' (which can't know by itself that $rprompt is being used and its value is a time-of-day pattern). Any ideas on how to deal with this? Either 1) how to recognize the presence of the added time (appearing at the left) and treat it as part of the prompt, or 2) (not as good, because it won't help others who use my code) how to tell telnet not to use the time part of the prompt? Is there some variable similar to `comint-prompt-regexp' that will pick up $rprompt (or the concatenation of $prompt and $rprompt)? Note: I'm not interested in hearing about things like `comint-previous-matching-input' and `comint-previous-prompt' as the solution here. I'm not looking for how to find previous inputs using vanilla Emacs. Likewise, I'm not interested here in solutions that tell me how to use the shell itself to reuse past commands. I want to enable my own complete-and-cycle Emacs-Lisp code to work with the time-of-day that $rprompt adds and telnet seems to stick on the left, after the $prompt. FYI, my code is described here: http://www.emacswiki.org/cgi-bin/wiki/Icicles ... (the site is down at the moment, so I can't give the exact URL - if you're interested, look for Other Search Commands on this table-of-contents page).