branch: externals/org
commit 149973da2f4796f376007cbfcbc965437f2c0076
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    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 7b0d6ddab0..f148fead7c 100644
--- a/lisp/ob-shell.el
+++ b/lisp/ob-shell.el
@@ -295,6 +295,11 @@ var of the same value."
              (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 @@ var of the same value."
                               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

Reply via email to