I've attached two patches which replace the previous. I found cleaning the output was dramatically helped by calling `buffer-substring-no-properties' instead of `buffer-substring' in `org-babel-comint-async-filter'. I'm not sure why `buffer-substring' was originally used. `make test' shows no failures, so I assume it doesn't make a difference...? ---- On Tue, 07 Feb 2023 06:40:51 -0500 Ihor Radchenko wrote --- > That's likely because of the same reasons why prompt did not get cleaned > in synchronous blocks earlier. See `org-babel-comint-with-output'. That, my friend, was a wild ride. I'm curious about people's feelings on `org-babel-comint-with-output'. Personally, I get the heebie-jeebies. I can't shake feeling that there's a better way, especially since `org-babel-comint-async-filter' achieves similar ends. My hunch is that other Babel languages may want async and that now would be a good time to consolidate the common functionalities of `org-babel-comint-with-output' and `org-babel-comint-async-filter' . Maybe even unify the API. So far, `org-babel-comint-with-output' touches 9 languages and `org-babel-comint-async-filter' appears to touch 2 (soon to be 3). I suspect those numbers will only grow. I also can't shake the feeling that I might become ob-comint maintainer at some point...(not yet!). I'm curious what people's thoughts are.