From 4564627415b1e609acdddd6e92b33d51c8e427c1 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 2 Dec 2022 13:57:14 +0800 Subject: [PATCH] org-babel-comit-with-output: Fix when prompt is emitted partially MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/ob-comint.el (org-babel-comint-with-output): Do not rely on output filter when detecting prompt lines. Search for `comint-prompt-regexp' in the full output after applying the filter. This is needed when the filter is supplied with partial prompts. Reported-by: Frédéric Santos Link: https://orgmode.org/list/877czca7oj.fsf@u-bordeaux.fr --- lisp/ob-comint.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index e8d836707..064ba9446 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -117,6 +117,14 @@ or user `keyboard-quit' during execution of body." (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) + ;; Replace partially supplied input lines. + ;; This is needed when output filter spits partial lines that + ;; do not include a full prompt at a time. + (setq string-buffer + (replace-regexp-in-string + comint-prompt-regexp + ,org-babel-comint-prompt-separator + string-buffer)) ;; remove echo'd FULL-BODY from input (when (and ,remove-echo ,full-body (string-match