emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Help debugging R source code block output problem with :session


From: Jack Kamm
Subject: Re: Help debugging R source code block output problem with :session
Date: Mon, 07 Sep 2020 01:45:25 -0700

I just realized my patch had an issue where it freezes if there is an
error in the source block.

I'm attaching a second patch, to be applied on top of the first one, that fixes 
the issue.

diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index b37e3965a..5ddf0ebd1 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -441,7 +441,7 @@ (defun org-babel-R-evaluate-session
     (output
      (let* ((tmp-file (org-babel-temp-file "R-")))
        (with-temp-file tmp-file
-        (insert (concat body "\n" org-babel-R-eoe-indicator)))
+        (insert body))
        (with-current-buffer session
         (let* ((process (get-buffer-process (current-buffer)))
                (string-buffer "")
@@ -450,8 +450,9 @@ (defun org-babel-R-evaluate-session
                                            (concat string-buffer text)))
                       comint-output-filter-functions)))
           (ess-send-string
-           process (format "source('%s', print.eval=TRUE)"
-                           (org-babel-process-file-name tmp-file 'noquote)))
+           process (format "tryCatch(source('%s', print.eval=TRUE), 
finally=print(%s))"
+                           (org-babel-process-file-name tmp-file 'noquote)
+                           org-babel-R-eoe-indicator))
           (while (not (string-match (regexp-quote org-babel-R-eoe-output)
                                     string-buffer))
             (accept-process-output process))

reply via email to

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