branch: externals/org
commit 3776eba2f774af24bd26598fd6da5e754ff05a7d
Author: Matthew Trzcinski <[email protected]>
Commit: Matthew Trzcinski <[email protected]>
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.
---
lisp/ob-comint.el | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index 882e192894..e8d8e76094 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -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