emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ista Zahn <istazahn@gmail.com>
To: Eric Schulte <eric.schulte@gmx.com>
Cc: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Interweaveing code and results with :session
Date: Mon, 20 Aug 2012 07:10:22 -0400	[thread overview]
Message-ID: <CA+vqiLGjsuoGoThHav6n8Qpf+Ut8h4fXwkJ9dxdw3Fx0YcY=Dg@mail.gmail.com> (raw)
In-Reply-To: <871uj2jvje.fsf@gmx.com>

On Sun, Aug 19, 2012 at 7:40 PM, Eric Schulte <eric.schulte@gmx.com> wrote:
> Ista Zahn <istazahn@gmail.com> writes:
>
>> Hi,
>>
>> I would like to interweave multi-line R code and results, like this:
>>
>> #+begin_src R :results output
>> 2+2
>> 3+3
>> #+end_src
>>
>> #+results:
>> : > 2+2
>> : [1] 4
>> : > 3+3
>> : [1] 6
>>
>> while using R :session. The solution posted at
>> http://lists.gnu.org/archive/html/emacs-orgmode/2010-08/msg00785.html
>> is to set
>>
>> #+begin_src emacs-lisp
>> (setq org-babel-R-command "R --silent --no-save")
>> #+end_src
>>
>> This works, but only if session is not being used. For example:
>>
>> --8<---------------cut here---------------start------------->8---
>> #+begin_src emacs-lisp
>> (setq org-babel-R-command "R --silent --no-save")
>> #+end_src
>>
>> #+results:
>> : R --silent --no-save
>>
>> This works as desired:
>> #+begin_src R :results output
>> 2+2
>> 3+3
>> #+end_src
>>
>> #+RESULTS:
>> : > 2+2
>> : [1] 4
>> : > 3+3
>> : [1] 6
>> : >
>>
>> Does not interweave code and results when using :session:
>> #+begin_src R :results output :session *R*
>> 2+2
>> 3+3
>> #+end_src
>>
>> #+results:
>> : [1] 4
>> : [1] 6
>> --8<---------------cut here---------------end--------------->8---
>>
>> Is there a way to get this interweaved output while using :session?
>>
>
> Unfortunately I do not believe this is currently possible, however it
> shouldn't be hard to implement for someone familiar with ob-R.el.

Thanks Eric. I'm able to get the desired behavior by setting

  (setq org-babel-R-command "R --silent --save --restore")

instead of using :session

Obviously this is slow, and has other disadvantagages, but  it does
give interweaved results while allowing object persistance across code
blocks.

Best,
Ista

>
> Best,
>
>>
>> Thanks!
>> Ista
>>
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte

      reply	other threads:[~2012-08-20 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-18 15:06 Interweaveing code and results with :session Ista Zahn
2012-08-19 23:40 ` Eric Schulte
2012-08-20 11:10   ` Ista Zahn [this message]

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='CA+vqiLGjsuoGoThHav6n8Qpf+Ut8h4fXwkJ9dxdw3Fx0YcY=Dg@mail.gmail.com' \
    --to=istazahn@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.schulte@gmx.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).