[comp.emacs] Bug in shell-send-input.

arndt@zyx.SE (Arndt Jonasson) (07/03/88)

There is a bug in the function 'shell-send-input' in Gnu Emacs 18.49.
This is its documentation string:

  "Send input to subshell.
At end of buffer, sends all text after last output
 as input to the subshell, including a newline inserted at the end.
When not at end, copies current line to the end of the buffer and sends it,
after first attempting to discard any prompt at the beginning of the line
by matching the regexp that is the value of shell-prompt-pattern if possible.
This regexp should start with \"^\"."

That, however, is not what it does. If the line in question doesn't
contain a matching prompt, the whole line should be sent as is.
Instead, since the search isn't bounded, the next line containing a
prompt is sent. The fix is to bound the search to the current line:

In shell-send-input in shell.el, change

|    (re-search-forward shell-prompt-pattern nil t)

to

|    (re-search-forward shell-prompt-pattern (save-excursion
|					      (end-of-line)
|					      (point))
|		       t)

-- 
Arndt Jonasson, ZYX Sweden AB, Styrmansgatan 6, 114 54 Stockholm, Sweden
email address:	 arndt@zyx.SE	or	<backbone>!mcvax!enea!zyx!arndt