Friendly bump. I saw no comments on the patch part of my previous message and fear it may have been missed due to my inclusion of the lengthy and separate topic, "bug? org-babel-comint-with-output return value type".
The patches fix the prompt appearing in async shell results and are ready to go, barring the concern I have about being unable to test how the fix may affect non-shell languages. > ---- On Mon, 19 Feb 2024 12:07:55 +0100 Ihor Radchenko wrote --- > > Matt m...@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? :) -- 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
0001-testing-lisp-test-ob-comint.el-Make-test-for-prompt-.patch
Description: Binary data
0002-lisp-ob-comint.el-Create-comint-prompt-filter.patch
Description: Binary data
0003-testing-lisp-test-ob-comint.el-Make-test-for-echo-fi.patch
Description: Binary data
0004-lisp-ob-comint.el-Create-comint-echo-filter.patch
Description: Binary data
0005-lisp-ob-comint.el-Refactor-org-babel-comint-with-out.patch
Description: Binary data
0006-testing-lisp-test-ob-shell.el-Test-async-prompt-remo.patch
Description: Binary data
0007-lisp-ob-comint.el-Fix-prompt-appearing-in-async-shel.patch
Description: Binary data