What I want to do from inside a term shell is have a function called when there is new output or a certain regexp (e.g. a prompt) appears in in a term's output. The callback function should then be able to access text from the either the last time it was called, or from the last time that pattern was seen.
comint this would be a function stored in
comint-output-filter-functions, and for
Can this be done in term.el? If so, how?