help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Q on using shell mode remotely


From: Drew Adams
Subject: RE: Q on using shell mode remotely
Date: Mon, 31 Jul 2006 09:35:11 -0700

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]