[Top][All Lists]

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

Re: comint-interrupt-subjob also kills pending input

From: Miles Bader
Subject: Re: comint-interrupt-subjob also kills pending input
Date: 23 Jun 2002 09:12:30 +0900

Richard Stallman <address@hidden> writes:
>     That would make sense, but I'm not sure how possible it is to do a good
>     job -- the code doesn't ever know when you're seeing a real prompt or
>     not, just that there's some non-newline-terminated output.
> Comint has ways of recognizing prompts.  It has to have them.

The underlying process does not communicate which things are really
prompts, so it's impossible for comint to actually know for sure.
Comint currently has ways of _guessing_ which things are prompts, that
often do a `good enough job' for the tasks where they are used.

One way is the old `regexp' method, which is not used for most purposes
anymore.  It really sucks, because it guesses wrong insanely often; the
actual textual content of prompt is simply too varied and dynamic to
recognize this way.

Another way, used currently to highlight prompts, is to consider any
non-newline-terminated line at the end of the buffer a prompt, but to
update it dynamically so that any wrong guess (e.g. caused by partial
output) is quickly corrected.  Since one property of real prompts is
that the output pauses for input, this means that anything `noticeable'
as being highlighted as a prompt usually is one (when the user presses
RET, it `snapshots' the current prompt, guessing that the users' input
has validated that particular guess).

You can see that the latter will guess wrong in several situations,
(1) when output is split into several chunks, some of which don't end in
a newline, and (2) if the process outputs something that really doesn't
end in a newline, and then stops (but isn't actually waiting for input,
e.g. `Waiting for connection...' or something).

Case (1) is not a problem for prompt highlighting because it's fleeting
and not noticable.  Case (2) could be a considered ugly, but since it's
corrected as soon as the process finally outputs a newline, and while
waiting, the actual text of the output usually makes it clear whether
it's really a prompt or not, this isn't much of a problem in practice
(it's fairly rare for unix processes to do this sort of thing anyway).

So, for the `C-c C-c' case, the question is whether any of these wrong
guesses could cause problems.  I guess that in practice it would
normally not be a problem.

Freedom's just another word, for nothing left to lose   --Janis Joplin

reply via email to

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