From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Q on using shell mode remotely Date: Mon, 31 Jul 2006 11:51:27 -0600 Organization: IHS Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154368437 20674 80.91.229.2 (31 Jul 2006 17:53:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 31 Jul 2006 17:53:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 31 19:53:54 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 1G7bxf-0002g8-MX for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Jul 2006 19:53:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7bxf-0007zG-7e for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Jul 2006 13:53:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G7bxT-0007z1-UC for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 13:53:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G7bxS-0007yd-Cc for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 13:53:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7bxS-0007yY-7n for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 13:53:38 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G7c0A-00019Q-4x for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 13:56:26 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1G7bx0-0002Z7-4L for help-gnu-emacs@gnu.org; Mon, 31 Jul 2006 19:53:10 +0200 Original-Received: from 207.167.42.206 ([207.167.42.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 31 Jul 2006 19:53:08 +0200 Original-Received: from ihs_4664 by 207.167.42.206 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 31 Jul 2006 19:53:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 50 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.206 User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) In-Reply-To: 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:36391 Archived-At: Drew Adams wrote: > 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)? Why can't you just add a time pattern to telnet-prompt-pattern, which is used to set the buffer-local value of comint-prompt-pattern: (eval-after-load "telnet" '(setq telnet-prompt-pattern (concat telnet-prompt-pattern "\\([12]?[0-9]:[0-5][0-9][ap]m\\)?"))) -- Kevin