[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Prompts again WAS Re: [Orgmode] avoiding source block prompts
From: |
Eric Schulte |
Subject: |
Re: Prompts again WAS Re: [Orgmode] avoiding source block prompts |
Date: |
Wed, 28 Jul 2010 08:03:02 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
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" <address@hidden> 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" <address@hidden> 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:address@hidden 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.
>>> > > address@hidden
>>> > > http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>> >
>>>
>>> Charles C. Berry (858) 534-2098
>>> Dept of Family/Preventive
>>> Medicine
>>> E mailto:address@hidden 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.
>>> address@hidden
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>>>
>>
>> Charles C. Berry (858) 534-2098
>> Dept of Family/Preventive
>> Medicine
>> E mailto:address@hidden 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.
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>
> Charles C. Berry (858) 534-2098
> Dept of Family/Preventive Medicine
> E mailto:address@hidden UC San Diego
> http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901