org-babel-comint-with-output: Fix another edge case with REPL prompts

* lisp/ob-comint.el (org-babel-comint-with-output): Sometimes, REPL
can split whitespace between sequence of prompt prompt prompt.

In particular, inf-ruby did this on multiline input.
This commit is contained in:
Ihor Radchenko 2023-08-31 12:42:21 +03:00
parent 8000b11209
commit ff53846f31
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -111,12 +111,13 @@ or user `keyboard-quit' during execution of body."
;; Sometimes, we get multiple agglomerated
;; prompts together in a single output:
;; "prompt prompt prompt output"
;; Or even "<whitespace>prompt<whitespace>prompt ...>.
;; Remove them progressively, so that
;; possible "^" in the prompt regexp gets to
;; work as we remove the heading prompt
;; instance.
(if (string-prefix-p "^" comint-prompt-regexp)
(format "^\\(%s\\)+" (substring comint-prompt-regexp 1))
(format "^\\([ \t]*%s\\)+" (substring comint-prompt-regexp 1))
comint-prompt-regexp)
,org-babel-comint-prompt-separator
string-buffer))