emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: "Charles C. Berry" <cberry@tajo.ucsd.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: Prompts again WAS Re: avoiding source block prompts
Date: Wed, 28 Jul 2010 08:03:02 -0600	[thread overview]
Message-ID: <874ofj63dw.fsf@gmail.com> (raw)
In-Reply-To: Pine.LNX.4.64.1007271527370.23564@tajo.ucsd.edu

Thanks Chuck,

I've just swapped in your new and improved regexp.

I share your concern both that there could be cases where prompts aren't
matched, or more seriously where the actual output looks like a prompt
(e.g. user returns a prompt-like string).

Before taking this explicit prompt removal approach I tried
automatically removing comment lines from the input before passing it to
the inferior R process, however that ran into similar problems of users
potentially inputting valid strings which look like comments -- which
would be hard to catch without implementing a fairly sophisticated R
parser as part of Babel.

This new regexp looks like the best option for now.

Thanks! -- Eric

"Charles C. Berry" <cberry@tajo.ucsd.edu> writes:

> Eric,
>
> In ob-R.el, changing this
>
> 	  (if (string-match "^\\([ >]+\\)\\[[0-9]+\\]" line)
>
> to this
>
> 	  (if (string-match "^\\([ ]*[>+][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line)
>
> seems to fix things (note I added plus sign which is the continuation
> prompt in R).
>
> I tried it on a bunch of varied source blocks and it seems to work OK,
> but I worry that there may be case where it will fail.
>
> Chuck
>
>
> On Tue, 27 Jul 2010, Charles C. Berry wrote:
>
>>
>> Eric,
>>
>> I spoke too soon.
>>
>> Have a look at the following. You'll see that the prompts show up there. :-(
>>
>> Chuck
>>
>> #+begin_src R :session :results output
>> ### create x
>> x <- data.frame(a=rnorm(2),b=rnorm(2))
>> ### now print the result
>> x
>> #+end_src
>>
>> #+results:
>> :
>> : > >            a          b
>> :  1 0.2702748 -0.2938296
>> :  2 1.1095136  0.1769425
>>
>>
>>
>> On Tue, 27 Jul 2010, Charles C. Berry wrote:
>>
>>>  On Tue, 27 Jul 2010, Eric Schulte wrote:
>>>
>>> >   Hi Charles,
>>> > >   I just pushed up a fix for the extra prompts in your output.
>>> You will
>>> >   still have a blank line (the output from "x <- rnorm(1)"), however you
>>> >   can suppress that line by placing the "x <- rnorm(1)" command in a
>>> >   previous code block in the same session.
>>>
>>>  Eric,
>>>
>>>  Thanks. That works for me.
>>>
>>>  Chuck
>>>
>>> > >   Best -- Eric
>>> > >   "Charles C. Berry" <cberry@tajo.ucsd.edu> writes:
>>> > > >   I think this is a new feature or perhaps a bug, which I
>>> noticed when
>>> > >   upgrading to version 7.01.
>>> > > > >   The newline and the two prompts '> >' in the results
>>> block below did
>>> > >   not show up in the earlier versions I used.
>>> > > > >   If this is a 'feature', is there a clean way to change
>>> this behavior?
>>> > > > >   If this is a bug, is there a simple patch to fix it?
>>> > > > >   #+begin_src R :session :results output
>>> > >   ### create x
>>> > >   x <- rnorm(1)
>>> > >   ### now print the result
>>> > >   x
>>> > >   #+end_src
>>> > > > >   #+results:
>>> > >   :
>>> > > : > >   [1] 2.186783
>>> > > > > > >   What I would have liked is to have something that
>>> looks like this:
>>> > > > >   #+results:
>>> > > :   [1] 2.186783
>>> > > > >   Thanks,
>>> > > > >   Chuck
>>> > > > > > >   Charles C. Berry                            (858)
>>> 534-2098
>>> > >                                               Dept of
>>> Family/Preventive > >   Medicine
>>> > >   E mailto:cberry@tajo.ucsd.edu	            UC San Diego
>>> > >   http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San
>>> Diego > >   92093-0901
>>> > > > > > > > >   _______________________________________________
>>> > >   Emacs-orgmode mailing list
>>> > >   Please use `Reply All' to send replies to the list.
>>> > >   Emacs-orgmode@gnu.org
>>> > >   http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>> > 
>>>
>>>  Charles C. Berry                            (858) 534-2098
>>>                                             Dept of Family/Preventive
>>>  Medicine
>>>  E mailto:cberry@tajo.ucsd.edu	            UC San Diego
>>>  http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901
>>>
>>>
>>>
>>>  _______________________________________________
>>>  Emacs-orgmode mailing list
>>>  Please use `Reply All' to send replies to the list.
>>>  Emacs-orgmode@gnu.org
>>>  http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>>>
>>
>> Charles C. Berry                            (858) 534-2098
>>                                            Dept of Family/Preventive
>> Medicine
>> E mailto:cberry@tajo.ucsd.edu	            UC San Diego
>> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>
> Charles C. Berry                            (858) 534-2098
>                                             Dept of Family/Preventive Medicine
> E mailto:cberry@tajo.ucsd.edu	            UC San Diego
> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

  reply	other threads:[~2010-07-28 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 18:28 avoiding source block prompts Charles C. Berry
2010-07-27 18:18 ` Eric Schulte
2010-07-27 19:40   ` Charles C. Berry
2010-07-27 20:15     ` Prompts again WAS " Charles C. Berry
2010-07-27 22:31       ` Charles C. Berry
2010-07-28 14:03         ` Eric Schulte [this message]
2010-08-05  3:09           ` Charles C. Berry

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=874ofj63dw.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=cberry@tajo.ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    /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).