branch: externals/org
commit 5ebe761ae40c95062b00e3b01a6295774d7a018a
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>
Rename `org-babel-comint-prompt-regexp-old' to `...-fallback'
* lisp/ob-comint.el (org-babel-comint-prompt-regexp-fallback): Rename
to more accurate name. Leave the old name as an alias.
(org-babel-comint--set-fallback-prompt): Use the new name.
(org-babel-comint-with-output):
(org-babel-comint-wait-for-output):
* lisp/ob-clojure.el (ob-clojure-eval-with-inf-clojure):
* lisp/ob-haskell.el (org-babel-interpret-haskell):
* lisp/ob-ruby.el (org-babel-ruby-initiate-session):
* lisp/ob-shell.el (org-babel-sh-initiate-session):
---
lisp/ob-clojure.el | 4 ++--
lisp/ob-comint.el | 19 ++++++++++---------
lisp/ob-haskell.el | 2 +-
lisp/ob-ruby.el | 2 +-
lisp/ob-shell.el | 2 +-
5 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index c7ebbbb95e..98a66d1ec5 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -237,8 +237,8 @@ or set the `:backend' header argument"))))
"clojure" (format "clojure -A%s" alias)
cmd0)
cmd0)))
- (setq
- org-babel-comint-prompt-regexp-old comint-prompt-regexp
+ (setq-local
+ org-babel-comint-prompt-regexp-fallback comint-prompt-regexp
comint-prompt-regexp inf-clojure-comint-prompt-regexp)
(funcall-interactively #'inf-clojure cmd)
(goto-char (point-max))))
diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index 764927af74..b88ac445a5 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -58,7 +58,8 @@ executed inside the protection of `save-excursion' and
(let ((comint-input-filter (lambda (_input) nil)))
,@body))))))
-(defvar-local org-babel-comint-prompt-regexp-old nil
+(defvaralias 'org-babel-comint-prompt-regexp-old
'org-babel-comint-prompt-regexp-fallback)
+(defvar org-babel-comint-prompt-regexp-fallback nil
"Fallback regexp used to detect prompt.")
(defcustom org-babel-comint-fallback-regexp-threshold 5.0
@@ -69,11 +70,11 @@ This is useful when prompt unexpectedly changes."
:package-version '(Org . "9.7"))
(defun org-babel-comint--set-fallback-prompt ()
- "Swap `comint-prompt-regexp' and `org-babel-comint-prompt-regexp-old'."
- (when org-babel-comint-prompt-regexp-old
+ "Swap `comint-prompt-regexp' and `org-babel-comint-prompt-regexp-fallback'."
+ (when org-babel-comint-prompt-regexp-fallback
(let ((tmp comint-prompt-regexp))
- (setq comint-prompt-regexp org-babel-comint-prompt-regexp-old
- org-babel-comint-prompt-regexp-old tmp))))
+ (setq comint-prompt-regexp org-babel-comint-prompt-regexp-fallback
+ org-babel-comint-prompt-regexp-fallback tmp))))
(defun org-babel-comint--prompt-filter (string &optional prompt-regexp)
"Remove PROMPT-REGEXP from STRING.
@@ -144,7 +145,7 @@ or user `keyboard-quit' during execution of body."
(accept-process-output
(get-buffer-process (current-buffer))
org-babel-comint-fallback-regexp-threshold)
- (when (and org-babel-comint-prompt-regexp-old
+ (when (and org-babel-comint-prompt-regexp-fallback
(> (float-time (time-since start-time))
org-babel-comint-fallback-regexp-threshold)
(progn
@@ -154,7 +155,7 @@ or user `keyboard-quit' during execution of body."
(re-search-forward
(regexp-quote ,eoe-indicator) nil t)
(re-search-forward
- org-babel-comint-prompt-regexp-old nil t)))))
+ org-babel-comint-prompt-regexp-fallback nil
t)))))
(org-babel-comint--set-fallback-prompt))))
;; replace cut dangling text
(goto-char (process-mark (get-buffer-process (current-buffer))))
@@ -189,14 +190,14 @@ statement (not large blocks of code)."
(accept-process-output
(get-buffer-process buffer)
org-babel-comint-fallback-regexp-threshold)
- (when (and org-babel-comint-prompt-regexp-old
+ (when (and org-babel-comint-prompt-regexp-fallback
(> (float-time (time-since start-time))
org-babel-comint-fallback-regexp-threshold)
(progn
(goto-char comint-last-input-end)
(save-excursion
(re-search-forward
- org-babel-comint-prompt-regexp-old nil t))))
+ org-babel-comint-prompt-regexp-fallback nil t))))
(org-babel-comint--set-fallback-prompt))))))
(defun org-babel-comint-eval-invisibly-and-wait-for-file
diff --git a/lisp/ob-haskell.el b/lisp/ob-haskell.el
index 05f340fa0f..a96a28b6b1 100644
--- a/lisp/ob-haskell.el
+++ b/lisp/ob-haskell.el
@@ -153,7 +153,7 @@ This function should only be called by
`org-babel-execute:haskell'."
(add-hook 'inferior-haskell-hook
(lambda ()
(setq-local
- org-babel-comint-prompt-regexp-old comint-prompt-regexp
+ org-babel-comint-prompt-regexp-fallback comint-prompt-regexp
comint-prompt-regexp
(concat haskell-prompt-regexp "\\|^λ?> "))))
(org-babel-haskell-with-session session params
diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el
index d920fb585a..24b31c18cf 100644
--- a/lisp/ob-ruby.el
+++ b/lisp/ob-ruby.el
@@ -192,7 +192,7 @@ Session settings (`:ruby' header arg value) are taken from
PARAMS."
(when new-session?
(with-current-buffer session-buffer
(setq-local
- org-babel-comint-prompt-regexp-old comint-prompt-regexp
+ org-babel-comint-prompt-regexp-fallback comint-prompt-regexp
comint-prompt-regexp (concat "^" org-babel-ruby-prompt))
(insert org-babel-ruby-define-prompt ";")
(insert
"_org_prompt_mode=conf.prompt_mode;conf.prompt_mode=:CUSTOM;")
diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el
index 32b029044d..9222379a3f 100644
--- a/lisp/ob-shell.el
+++ b/lisp/ob-shell.el
@@ -294,7 +294,7 @@ var of the same value."
(alist-get t org-babel-shell-set-prompt-commands))
org-babel-sh-prompt))
(setq-local
- org-babel-comint-prompt-regexp-old comint-prompt-regexp
+ org-babel-comint-prompt-regexp-fallback comint-prompt-regexp
comint-prompt-regexp
(concat "^" (regexp-quote org-babel-sh-prompt)
" *"))