summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Juste <jeremiejuste@gmail.com>2021-05-03 00:15:09 +0200
committerJeremie Juste <jeremiejuste@gmail.com>2021-05-03 00:15:09 +0200
commitac8c009e006197d2dad226dbe822d450aec23d23 (patch)
tree3c8bbc1853dc019adfc86f7cd2ad3439a0ee38ae
parent884a3454fc0a80ee044b91ea2173fe53baf5e71d (diff)
downloadorg-mode-ac8c009e006197d2dad226dbe822d450aec23d23.tar.gz
lisp/ob-R.el: Fix session output with substrings matching prompts
* lisp/ob-R.el (org-babel-R-evaluate-session): New implementation for session output results, that concat "^" to comint-prompt-regexp to avoid prompt confusion with R. Patch suggested by Jack Kamm: https://orgmode.org/list/87h7slgbi5.fsf@gmail.com/
-rw-r--r--lisp/ob-R.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index c4dba88..2d9073c 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -451,11 +451,13 @@ last statement in BODY, as elisp."
(car (split-string line "\n")))
(substring line (match-end 1))
line))
- (org-babel-comint-with-output (session org-babel-R-eoe-output)
- (insert (mapconcat 'org-babel-chomp
- (list body org-babel-R-eoe-indicator)
- "\n"))
- (inferior-ess-send-input)))))) "\n"))))
+ (with-current-buffer session
+ (let ((comint-prompt-regexp (concat "^" comint-prompt-regexp)))
+ (org-babel-comint-with-output (session org-babel-R-eoe-output)
+ (insert (mapconcat 'org-babel-chomp
+ (list body org-babel-R-eoe-indicator)
+ "\n"))
+ (inferior-ess-send-input)))))))) "\n"))))
(defun org-babel-R-process-value-result (result column-names-p)
"R-specific processing of return value.