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):
This commit is contained in:
parent
433fbdbc63
commit
5ebe761ae4
|
@ -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))))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;")
|
||||
|
|
|
@ -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)
|
||||
" *"))
|
||||
|
|
Loading…
Reference in New Issue