From: Eric Schulte <schulte.eric@gmail.com>
To: John Hendy <jw.hendy@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Using cat() with R prints R session prompt (>) in results block
Date: Sat, 23 Mar 2013 16:20:31 -0600 [thread overview]
Message-ID: <87vc8hpwvz.fsf@gmail.com> (raw)
In-Reply-To: CA+M2ft9DZGYrJs1Ux3fhwN9OXmOL-mQVoXV+4gRr3iRJrYE+KQ@mail.gmail.com
[...]
> I'm getting the > prompt from my R session output
> with the cat() command. For example:
>
> #+name: test
> #+begin_src R :session r :results output raw :exports results
>
> cat(paste("#+end_center"))
> cat("\n")
>
> #+end_src
>
> #+RESULTS: test
> #+end_center>
>
> How do I stop that?
>
> As a side note... if I remove cat("\n"), nothing gets put into the
> #+results block -- it's just empty. I don't understand why.
>
Hi John,
This seems to be related to newlines and the parsing of session output.
Results aren't noticed without a newline, and when intermediately
printed results do not end in a newline, the prompt is pasted along with
the results.
If we look at the R session buffer, the cause of this bad behavior can
be seen.
,----[ESS buffer]
| > cat(paste("#+end_center"))
| cat("\n")
| 'org_babel_R_eoe'
| cat(paste("#+end_center"))
| #+end_center> cat("\n")
|
|
| > 'org_babel_R_eoe'
| [1] "org_babel_R_eoe"
`----
I'm not sure that we can (robustly and reasonably) distinguish the R
prompt from R process output when the prompt does not appear at the
start of a line. Perhaps ESS could mark R prompts with a special text
property which would make this much easier from the Org-mode side?
Is it possible simply to ensure that code block output lines end in
newlines?
Cheers,
--
Eric Schulte
http://cs.unm.edu/~eschulte
next prev parent reply other threads:[~2013-03-23 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 23:19 Using cat() with R prints R session prompt (>) in results block John Hendy
2013-03-23 22:20 ` Eric Schulte [this message]
2013-03-24 1:32 ` John Hendy
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=87vc8hpwvz.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jw.hendy@gmail.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).