From ff53846f31da065e80d7fb53738c8b46bfcb1790 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Thu, 31 Aug 2023 12:42:21 +0300 Subject: [PATCH] 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. --- lisp/ob-comint.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index 6ecf8cd9c..d6c048c58 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -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 "promptprompt ...>. ;; 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))