[comp.emacs] shell-send-input and the ">" character

rob@linkers.med.utah.edu (Rob Sargent) (12/01/90)

I use shells within emacs constantly. In particular a use Ingres. Thus
I frequently use the ">" character. Everything works fine... except
when I wish to re-do a quel command that has a ">" in it. ( I do this
by putting the cursor on the old command (which is of course somewhere
upstream from end-of-buffer), and then hitting return (which in
shell-mode is bound to shell-send-input. Invariable what gets sent is
only that part of the line after the ">"! I suspect shell-send-input
is treating everything to the left of the ">" as part of some supposed
prompt. Is there any way of undoing this special meaning of the ">"
vis shell-send-input.

Thanks in advance.

hollen@megatek (Dion Hollenbeck) (12/04/90)

In article <ROB.90Nov30163126@linkers.med.utah.edu> rob@linkers.med.utah.edu (Rob Sargent) writes:
> 
> I use shells within emacs constantly. In particular a use Ingres. Thus
> I frequently use the ">" character. Everything works fine... except
> when I wish to re-do a quel command that has a ">" in it. ( I do this
> by putting the cursor on the old command (which is of course somewhere
> upstream from end-of-buffer), and then hitting return (which in
> shell-mode is bound to shell-send-input. Invariable what gets sent is
> only that part of the line after the ">"! I suspect shell-send-input
> is treating everything to the left of the ">" as part of some supposed
> prompt. Is there any way of undoing this special meaning of the ">"
> vis shell-send-input.

What is going on is controlled by shell-prompt-pattern which is a
regular expression to be looked for and cast aside everything before
and including it.  My pattern is here and takes account of my 
"hostname ->" prompt dbx's ")" prompt, and the "#" promopt when
I am root.  Since I am not real good at regular expressions, I
will not attempt to give you the correct one, but you should be
able to come up with one which either will suit all types of
prompts, or you can change the value of the constant as you
move from system to system as appropriate.  Here is mine as an
example:

(defconst shell-prompt-pattern "^.*[x-][>#)] *" "\
*Regexp used by Newline command in shell mode to match subshell prompts.
Anything from beginning of line up to the end of what this pattern matches
is deemed to be prompt, and is not reexecuted.")


--
	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121
        uunet!megatek!hollen       or  hollen@megatek.uucp