emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org ac8c009 1/3: lisp/ob-R.el: Fix session output with


From: ELPA Syncer
Subject: [elpa] externals/org ac8c009 1/3: lisp/ob-R.el: Fix session output with substrings matching prompts
Date: Sun, 2 May 2021 18:57:13 -0400 (EDT)

branch: externals/org
commit ac8c009e006197d2dad226dbe822d450aec23d23
Author: Jeremie Juste <jeremiejuste@gmail.com>
Commit: Jeremie Juste <jeremiejuste@gmail.com>

    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/
---
 lisp/ob-R.el | 12 +++++++-----
 1 file 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]