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: Berry, Charles
Subject: Re: Help debugging R source code block output problem with :session
Date: Mon, 7 Sep 2020 17:37:51 +0000

Jack,

This does not work for my remote session.

I run from macOS locally and on a Linux host remotely.  I use 

        M-x shell RET
        R RET
        M-x ess-remote RET R RET

to start the R session.

The problem is that tempfiles on the remote host are like 
"/tmp/RtmpeFHudh/file23a66d2fc1f9", but emacs tries to use 
'/var/folders/kb/2hchpbyj7lb6z76l0q73w_fh0000gn/T/babel-OSXKNd/R-oNOVVB'

`org-babel-temp-file' doesn't honor remote connections AFAICS.

Maybe there is some comint or tramp idiom that would solve this, but I do not 
know what it is.

Chuck

> On Sep 7, 2020, at 1:45 AM, Jack Kamm <jackkamm@gmail.com> wrote:
> 
> 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]