From 21d9bcdc22c0b601e40316dd6df7394344d4cccf Mon Sep 17 00:00:00 2001 Message-ID: <21d9bcdc22c0b601e40316dd6df7394344d4cccf.1719774270.git.yantar92@posteo.net> In-Reply-To: References: From: Ihor Radchenko Date: Sun, 30 Jun 2024 20:59:22 +0200 Subject: [PATCH 3/4] org-babel-sh-initiate-session: Fix setting non-standard prompt * lisp/ob-shell.el (org-babel-sh-initiate-session): Set `comint-prompt-regexp' early, _before_ evaluating prompt change. This way, we make sure that comint is not stuck trying to search for the old prompt if the new prompt no longer matches `comint-prompt-regexp'. --- lisp/ob-shell.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el index 7b0d6ddab..f148fead7 100644 --- a/lisp/ob-shell.el +++ b/lisp/ob-shell.el @@ -295,6 +295,11 @@ (defun org-babel-sh-initiate-session (&optional session _params) (shell session) ;; Set unique prompt for easier analysis of the output. (org-babel-comint-wait-for-output (current-buffer))) + (setq-local + org-babel-comint-prompt-regexp-fallback comint-prompt-regexp + comint-prompt-regexp + (concat "^" (regexp-quote org-babel-sh-prompt) + " *")) (org-babel-comint-input-command (current-buffer) (format @@ -302,11 +307,6 @@ (defun org-babel-sh-initiate-session (&optional session _params) org-babel-shell-set-prompt-commands)) (alist-get t org-babel-shell-set-prompt-commands)) org-babel-sh-prompt)) - (setq-local - org-babel-comint-prompt-regexp-fallback comint-prompt-regexp - comint-prompt-regexp - (concat "^" (regexp-quote org-babel-sh-prompt) - " *")) (setq org-babel-sh--prompt-initialized t) ;; Needed for Emacs 23 since the marker is initially ;; undefined and the filter functions try to use it without -- 2.45.2