[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 227cbb5359 2/7: lisp/ob-comint.el: Create comint pr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 227cbb5359 2/7: lisp/ob-comint.el: Create comint prompt filter |
Date: |
Fri, 29 Mar 2024 09:58:25 -0400 (EDT) |
branch: externals/org
commit 227cbb53592e853133ada4a429b8cceedc837f89
Author: Matthew Trzcinski <matt@excalamus.com>
Commit: Matthew Trzcinski <matt@excalamus.com>
lisp/ob-comint.el: Create comint prompt filter
* lisp/ob-comint.el (org-babel-comint--prompt-filter): Extract prompt
filtering logic from `org-babel-comint-with-output' into a new
function.
---
lisp/ob-comint.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index 1ec84e8652..882e192894 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -74,6 +74,19 @@ This is useful when prompt unexpectedly changes."
(setq comint-prompt-regexp org-babel-comint-prompt-regexp-old
org-babel-comint-prompt-regexp-old tmp))))
+(defun org-babel-comint--prompt-filter (string &optional prompt-regexp)
+ "Remove PROMPT-REGEXP from STRING.
+
+PROMPT-REGEXP defaults to `comint-prompt-regexp'."
+ (let* ((prompt-regexp (or prompt-regexp comint-prompt-regexp))
+ (separator "org-babel-comint--prompt-filter-separator\n"))
+ (while (string-match-p prompt-regexp string)
+ (setq string
+ (replace-regexp-in-string
+ (format "\\(?:%s\\)?\\(?:%s\\)[ \t]*" separator prompt-regexp)
+ separator string)))
+ (delete "" (split-string string separator))))
+
(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
- [elpa] externals/org updated (1be2f96931 -> e9c288dfac), ELPA Syncer, 2024/03/29
- [elpa] externals/org e9c288dfac 7/7: lisp/ob-comint.el: Fix prompt appearing in async shell results, ELPA Syncer, 2024/03/29
- [elpa] externals/org 227cbb5359 2/7: lisp/ob-comint.el: Create comint prompt filter,
ELPA Syncer <=
- [elpa] externals/org c2b763dd14 3/7: testing/lisp/test-ob-comint.el: Make test for echo filter, ELPA Syncer, 2024/03/29
- [elpa] externals/org 574e04d119 5/7: lisp/ob-comint.el: Refactor `org-babel-comint-with-output', ELPA Syncer, 2024/03/29
- [elpa] externals/org 0102988afb 6/7: testing/lisp/test-ob-shell.el: Test async prompt removal, ELPA Syncer, 2024/03/29
- [elpa] externals/org 820a99b171 1/7: testing/lisp/test-ob-comint.el: Make test for prompt filter, ELPA Syncer, 2024/03/29
- [elpa] externals/org 3776eba2f7 4/7: lisp/ob-comint.el: Create comint echo filter, ELPA Syncer, 2024/03/29