lisp/ob-comint.el: Create comint echo filter

* lisp/ob-comint.el (org-babel-comint--echo-filter): Extract echo
filtering logic from `org-babel-comint-with-output' into a new
function.
This commit is contained in:
Matthew Trzcinski 2024-03-17 16:58:52 +01:00
parent c2b763dd14
commit 3776eba2f7
1 changed files with 9 additions and 0 deletions

View File

@ -87,6 +87,15 @@ PROMPT-REGEXP defaults to `comint-prompt-regexp'."
separator string)))
(delete "" (split-string string separator))))
(defun org-babel-comint--echo-filter (string &optional echo)
"Remove ECHO from STRING."
(and echo string
(string-match
(replace-regexp-in-string "\n" "[\r\n]+" (regexp-quote echo))
string)
(setq string (substring string (match-end 0))))
string)
(defmacro org-babel-comint-with-output (meta &rest body)
"Evaluate BODY in BUFFER and return process output.
Will wait until EOE-INDICATOR appears in the output, then return