emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jeremie Juste <jeremiejuste@gmail.com>
To: "Berry, Charles" <ccberry@health.ucsd.edu>
Cc: Jack Kamm <jackkamm@gmail.com>, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] async process in R
Date: Tue, 28 Sep 2021 09:34:43 +0200	[thread overview]
Message-ID: <87h7e5b1bg.fsf@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <FB6FDAC2-681E-415B-9304-923CEB184F53@health.ucsd.edu> (Charles Berry's message of "Mon, 27 Sep 2021 23:40:24 +0000")

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

Hello Chuck,

On Monday, 27 Sep 2021 at 23:40, Berry, Charles wrote:
> Jeremie,
>
>> On Sep 27, 2021, at 3:56 PM, Berry, Charles <ccberry@health.ucsd.edu> wrote:
>> 
>> There is something in my init that doesn't play nice with this.  
>
> (setq ess-inject-source nil)

Thanks for the feedback. With the following patch, I made sure that
ess-inject-source is set to default before evaluating the buffer.

So even if I set
(setq ess-inject-source 'function-and-buffer), I get the following
output. Note that I get the same output in the IESS console buffer when
I execute the command following command.

#+begin_src R :session *R*  :results output :async yes
  Sys.sleep(2)
  1:5

  10:20
  1:2
#+end_src

#+RESULTS:
: [1] 1 2 3 4 5
:  [1] 10 11 12 13 14 15 16 17 18 19 20
: [1] 1 2

It might be good to fix this on the ESS side. I'll see what can be
done, but I'd appreciate any input you might have on this. Thanks again.

Best regards,
Jeremie


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch3 --]
[-- Type: text/x-diff, Size: 1258 bytes --]

From db2ad631247a5c52d9d6f6779948f6d0cf34c698 Mon Sep 17 00:00:00 2001
From: Jeremie Juste <djj@debian-BULLSEYE-live-builder-AMD64>
Date: Tue, 28 Sep 2021 09:04:25 +0200
Subject: [PATCH] ob-R.el: Patch async evaluation when :results output

* lisp/ob-R.el (ob-session-async-org-babel-R-evaluate-session): Make
sure that `ess-inject-source' is set to the default
'function-and-buffer before running (ess-eval-buffer). Return
`ess-inject-source' to its user-specified state afterwards.
---
 lisp/ob-R.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index 188b9ac8f..7e050c094 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -528,9 +528,13 @@ by `org-babel-comint-async-filter'."
          (insert (format ob-session-async-R-indicator
 			 "end" uuid))
          (setq tmp ess-eval-visibly)
+         (setq user-inject-src-param ess-inject-source)
          (setq ess-eval-visibly nil)
+         (setq  ess-inject-source 'function-and-buffer)
          (ess-eval-buffer nil))
-         (setq ess-eval-visibly tmp)
+       (setq ess-eval-visibly tmp)
+       (setq ess-inject-source user-inject-src-param)
+       
        uuid))))
 
 (defun ob-session-async-R-value-callback (params tmp-file)
-- 
2.30.2


  reply	other threads:[~2021-09-28  7:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 17:13 Jeremie Juste
2021-09-26 18:33 ` Greg Minshall
2021-09-26 19:52   ` Jeremie Juste
2021-09-27  4:04     ` Greg Minshall
2021-09-27  6:48       ` Bastien
2021-09-27 19:21         ` Jeremie Juste
2021-09-28  3:02           ` Jack Kamm
2021-09-27  8:18 ` Bastien
2021-09-27 18:28 ` Berry, Charles via General discussions about Org-mode.
2021-09-27 19:25   ` Jeremie Juste
2021-09-27 20:28   ` Jeremie Juste
2021-09-27 22:56     ` Berry, Charles via General discussions about Org-mode.
2021-09-27 23:40       ` Berry, Charles via General discussions about Org-mode.
2021-09-28  7:34         ` Jeremie Juste [this message]
2021-09-28 18:22           ` Berry, Charles via General discussions about Org-mode.
2021-09-28 20:40             ` Jeremie Juste
2021-10-02 22:57               ` Jack Kamm
2021-10-02 22:54 ` Jack Kamm
2021-10-02 23:14   ` Jack Kamm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7e5b1bg.fsf@debian-BULLSEYE-live-builder-AMD64 \
    --to=jeremiejuste@gmail.com \
    --cc=ccberry@health.ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=jackkamm@gmail.com \
    --subject='Re: [PATCH] async process in R' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).