From e9c288dfaccc2960e5b6889e6aabea700ad4e05a Mon Sep 17 00:00:00 2001 From: Matthew Trzcinski Date: Sun, 17 Mar 2024 19:04:39 +0100 Subject: [PATCH] lisp/ob-comint.el: Fix prompt appearing in async shell results * lisp/ob-comint.el (org-babel-comint-async-filter): Call prompt `org-babel-comint--prompt-filter' Reported-by: "Matthew Trzcinski" Link: https://list.orgmode.org/18d753c1e8a.cfb3e1921191837.5665565128507976741@excalamus.com/ --- lisp/ob-comint.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index d13aacccc..f2251892a 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -325,9 +325,10 @@ STRING contains the output originally inserted into the comint buffer." until (and (equal (match-string 1) "start") (equal (match-string 2) uuid)) finally return (+ 1 (match-end 0))))) - ;; Apply callback to clean up the result - (res-str (funcall org-babel-comint-async-chunk-callback - res-str-raw))) + ;; Remove prompt + (res-promptless (org-trim (string-join (mapcar #'org-trim (org-babel-comint--prompt-filter res-str-raw)) "\n") "\n")) + ;; Apply user callback + (res-str (funcall org-babel-comint-async-chunk-callback res-promptless))) ;; Search for uuid in associated org-buffers to insert results (cl-loop for buf in org-buffers until (with-current-buffer buf