---- On Mon, 19 Feb 2024 12:07:55 +0100 Ihor Radchenko wrote --- > Matt matt@excalamus.com> writes: > > > - Split prompt filtering and input echoing into two filters > > + this seems to imply a =-hook= or =-functions= type implementation > > Not necessarily. You may just split the filter into (1) prompt > remover; (2) body remover. The filter does not need to interact with > comint buffer and may simply be provided a regexp/string to be removed. > Then, the caller will be responsible to supply prompt regexp/body. Attached are patches which split the prompt and echo filtering into separate functions. These are then used to refactor =org-babel-comint-with-output= and to remove the prompt from async results. I also wrote tests, one for the reported bug and two for the filter functions. Tests for the filter functions are in a new file, 'test-ob-comint.el'. Two thoughts: 1. Can people please test that the changes to =org-babel-comint-with-output= haven't broken other languages? The filter, which I extracted from =org-babel-comint-with-output=, works according to the test I wrote. The test is based on ob-shell output. However, =org-babel-comint-with-output= is used by other languages. I wasn't sure if echoes showed up for other languages and I had no examples from other languages to work from. The filter is untested for anything but shell, aside from running 'make test' (which returns no unexpected errors). If no echo argument is given, the filter simply returns the string it would otherwise try to remove the echo from. So, I suspect the worst outcome would be that echoes might start showing up in output. But when have my predictions ever been right? :) 2. Legacy code woes I'll start another thread to rant, er, discuss. -- Matt Trzcinski Emacs Org contributor (ob-shell) Learn more about Org mode at https://orgmode.org Support Org development at https://liberapay.com/org-mode