emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] Using :prologue and :epilogue with unbalanced brackets
@ 2014-01-20 14:11 Rainer M Krug
  2014-01-20 15:34 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Rainer M Krug @ 2014-01-20 14:11 UTC (permalink / raw)
  To: emacs orgmode-mailinglist

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

I would like to use :prologue and :epilogue to enclose the code block
in a local({}) block, i.e.

* test
#+begin_src R :prologue local({   :epilogue })
qwerty <- "test"
#+end_src

But the problem seems to be the unbalanced brackets, and everything is
passed on as the prologue, as I get the error:

Error: unexpected ':' in:
"{
local({  :"
Execution halted

Can I somehow use unbalanced brackets, or is this a missing option in
epilogue and prologue?

Cheers,

Rainer


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS3S6KAAoJENvXNx4PUvmCh84IAOsNxX9EtQPuHLGZrwIwFdzX
PZCj1Iq576gbCvHHkzaepAtGWsb0k/D0FBoFCA1rjJWHKU5gn6H32nVRBEGM/uct
5OzG7sKViJ4ED60qIYb/n4gogDudhA1AC8W2qvag1y30U/NX9VSBUaCdGQfZxMjP
azuyvKFtrbUx3+1Ob/Ch/DDr+msndQilzyibP5OFYjjHmHKz+XvjkN9xQoDusesA
L/XqDWCecBsYTwp/+v3mdIK4fFk2L1HmQ+tWBm1QmaL/DNYVEEFuXZEcwYrocVX+
cUh2v/o1sXihGvHWLoXbhxxKiXpEl3QzHChXNuc755KcG4fQpmuqHILvyxuCkEo=
=MDD2
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Using :prologue and :epilogue with unbalanced brackets
  2014-01-20 14:11 [babel] Using :prologue and :epilogue with unbalanced brackets Rainer M Krug
@ 2014-01-20 15:34 ` Eric Schulte
  2014-01-21 10:28   ` Rainer M Krug
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2014-01-20 15:34 UTC (permalink / raw)
  To: Rainer; +Cc: emacs orgmode-mailinglist

Rainer M Krug <Rainer@krugs.de> writes:

> Hi
>
> I would like to use :prologue and :epilogue to enclose the code block
> in a local({}) block, i.e.
>
> * test
> #+begin_src R :prologue local({   :epilogue })
> qwerty <- "test"
> #+end_src
>

I tried wrapping the prologue and epilogue values in quotes so that they
would be interpreted as strings, and I no longer see the problem you
describe and it works in a session, but I get a different R issues
outside of a session.

Best,

>
> But the problem seems to be the unbalanced brackets, and everything is
> passed on as the prologue, as I get the error:
>
> Error: unexpected ':' in:
> "{
> local({  :"
> Execution halted
>
> Can I somehow use unbalanced brackets, or is this a missing option in
> epilogue and prologue?
>
> Cheers,
>
> Rainer
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax :       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      Rainer@krugs.de
>
> Skype:      RMkrug

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Using :prologue and :epilogue with unbalanced brackets
  2014-01-20 15:34 ` Eric Schulte
@ 2014-01-21 10:28   ` Rainer M Krug
  2014-01-26 18:16     ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Rainer M Krug @ 2014-01-21 10:28 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs orgmode-mailinglist

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 01/20/14, 16:34 , Eric Schulte wrote:
> Rainer M Krug <Rainer@krugs.de> writes:
> 
>> Hi
>>
>> I would like to use :prologue and :epilogue to enclose the code block
>> in a local({}) block, i.e.
>>
>> * test
>> #+begin_src R :prologue local({   :epilogue })
>> qwerty <- "test"
>> #+end_src
>>
> 
> I tried wrapping the prologue and epilogue values in quotes so that they
> would be interpreted as strings, and I no longer see the problem you
> describe and it works in a session, but I get a different R issues
> outside of a session.

Agreed - 

* test
#+begin_src R  :results output :prologue "local({" :epilogue "})" :session
  cat("Test")
#+end_src

#+RESULTS:

no :session nothing happens

using :session the execution does not complete because the :epilogue is not appended.


* test 2
#+begin_src R  :results output :prologue "cat(1, '###\n')" :epilogue "cat(2, '###\n')" :session
  cat("Test\n")
#+end_src

#+RESULTS:
: 1 ###
: Test

works under :session and without

but 
* test 2
#+begin_src R  :results output :prologue "{cat(1, 2 )"   :epilogue "cat(2, 3)}" :session
  cat("Test\n")
#+end_src

works only without :session as R is waiting for the "}" which is in the :epilogue but which is not added.

Cheers,

Rainer


> 
> Best,
> 
>>
>> But the problem seems to be the unbalanced brackets, and everything is
>> passed on as the prologue, as I get the error:
>>
>> Error: unexpected ':' in:
>> "{
>> local({  :"
>> Execution halted
>>
>> Can I somehow use unbalanced brackets, or is this a missing option in
>> epilogue and prologue?
>>
>> Cheers,
>>
>> Rainer
>>
>>
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>> Biology, UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Stellenbosch University
>> South Africa
>>
>> Tel :       +33 - (0)9 53 10 27 44
>> Cell:       +33 - (0)6 85 62 59 98
>> Fax :       +33 - (0)9 58 10 27 44
>>
>> Fax (D):    +49 - (0)3 21 21 25 22 44
>>
>> email:      Rainer@krugs.de
>>
>> Skype:      RMkrug
> 

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS3ku9AAoJENvXNx4PUvmC7ngH/ieVPjonhs5J9fKNJADzf3yo
XjkJ22prTY13ZggXBmp85suZzCuMJDP8FtpI2jBOfjAJvwIHiYL7g+rmHBFvXyV5
3tErw4qwQ9xsrwOdAor9tnnFe7WnzZCBGx/Dp8FyWKu28qvqQDzm+QHvWbXtOS1J
tlq3QY9mPeK/T1xxWCDUwUMwe+Sfmta3eQSWcn+zvfwrhBAp8Fo5ifzcTMWqe9XW
OIkRjEDiYBY85GkuEN2nlmWrM67OZuq/XVVif5nclASufiA/3Z5XKeW5R01BMwPr
EFlYy3WcgJcIPMsJjpMlIl6pjKGi2wnzsSoS8tWTyL5uPqgTgCsMnmg3QAUS/n4=
=JHaw
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Using :prologue and :epilogue with unbalanced brackets
  2014-01-21 10:28   ` Rainer M Krug
@ 2014-01-26 18:16     ` Eric Schulte
  2014-01-27  9:16       ` Rainer M Krug
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2014-01-26 18:16 UTC (permalink / raw)
  To: Rainer; +Cc: emacs orgmode-mailinglist

Rainer M Krug <Rainer@krugs.de> writes:

> On 01/20/14, 16:34 , Eric Schulte wrote:
>> Rainer M Krug <Rainer@krugs.de> writes:
>>
>>> Hi
>>>
>>> I would like to use :prologue and :epilogue to enclose the code block
>>> in a local({}) block, i.e.
>>>
>>> * test
>>> #+begin_src R :prologue local({   :epilogue })
>>> qwerty <- "test"
>>> #+end_src
>>>
>>
>> I tried wrapping the prologue and epilogue values in quotes so that they
>> would be interpreted as strings, and I no longer see the problem you
>> describe and it works in a session, but I get a different R issues
>> outside of a session.
>
> Agreed -
>
> * test
> #+begin_src R  :results output :prologue "local({" :epilogue "})" :session
>   cat("Test")
> #+end_src
>
> #+RESULTS:
>
> no :session nothing happens
>
> using :session the execution does not complete because the :epilogue is not appended.
>

The problem here is when `org-babel-balanced-split' parses the following
string.

  ":results output :prologue \"local({\" :epilogue \"})\" :session"

It isn't smart enough to *not* balance the ({}) parens because of the
enclosing quotes.  Unfortunately I don't have time to address this right
now.  A hacky work around would be the following...

#+headers: :epilogue "})"
#+headers: :prologue "local({"
#+begin_src R  :results output :session
  cat("Test")
#+end_src

Best,

>
>
> * test 2
> #+begin_src R  :results output :prologue "cat(1, '###\n')" :epilogue "cat(2, '###\n')" :session
>   cat("Test\n")
> #+end_src
>
> #+RESULTS:
> : 1 ###
> : Test
>
> works under :session and without
>
> but
> * test 2
> #+begin_src R  :results output :prologue "{cat(1, 2 )"   :epilogue "cat(2, 3)}" :session
>   cat("Test\n")
> #+end_src
>
> works only without :session as R is waiting for the "}" which is in the :epilogue but which is not added.
>
> Cheers,
>
> Rainer
>
>
>>
>> Best,
>>
>>>
>>> But the problem seems to be the unbalanced brackets, and everything is
>>> passed on as the prologue, as I get the error:
>>>
>>> Error: unexpected ':' in:
>>> "{
>>> local({  :"
>>> Execution halted
>>>
>>> Can I somehow use unbalanced brackets, or is this a missing option in
>>> epilogue and prologue?
>>>
>>> Cheers,
>>>
>>> Rainer
>>>
>>>
>>> --
>>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>>> Biology, UCT), Dipl. Phys. (Germany)
>>>
>>> Centre of Excellence for Invasion Biology
>>> Stellenbosch University
>>> South Africa
>>>
>>> Tel :       +33 - (0)9 53 10 27 44
>>> Cell:       +33 - (0)6 85 62 59 98
>>> Fax :       +33 - (0)9 58 10 27 44
>>>
>>> Fax (D):    +49 - (0)3 21 21 25 22 44
>>>
>>> email:      Rainer@krugs.de
>>>
>>> Skype:      RMkrug
>>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax :       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      Rainer@krugs.de
>
> Skype:      RMkrug

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Using :prologue and :epilogue with unbalanced brackets
  2014-01-26 18:16     ` Eric Schulte
@ 2014-01-27  9:16       ` Rainer M Krug
  0 siblings, 0 replies; 5+ messages in thread
From: Rainer M Krug @ 2014-01-27  9:16 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs orgmode-mailinglist

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 01/26/14, 19:16 , Eric Schulte wrote:
> Rainer M Krug <Rainer@krugs.de> writes:
> 
>> On 01/20/14, 16:34 , Eric Schulte wrote:
>>> Rainer M Krug <Rainer@krugs.de> writes:
>>> 
>>>> Hi
>>>> 
>>>> I would like to use :prologue and :epilogue to enclose the
>>>> code block in a local({}) block, i.e.
>>>> 
>>>> * test #+begin_src R :prologue local({   :epilogue }) qwerty
>>>> <- "test" #+end_src
>>>> 
>>> 
>>> I tried wrapping the prologue and epilogue values in quotes so
>>> that they would be interpreted as strings, and I no longer see
>>> the problem you describe and it works in a session, but I get a
>>> different R issues outside of a session.
>> 
>> Agreed -
>> 
>> * test #+begin_src R  :results output :prologue "local({"
>> :epilogue "})" :session cat("Test") #+end_src
>> 
>> #+RESULTS:
>> 
>> no :session nothing happens
>> 
>> using :session the execution does not complete because the
>> :epilogue is not appended.
>> 
> 
> The problem here is when `org-babel-balanced-split' parses the
> following string.
> 
> ":results output :prologue \"local({\" :epilogue \"})\" :session"
> 
> It isn't smart enough to *not* balance the ({}) parens because of
> the enclosing quotes.  Unfortunately I don't have time to address
> this right now.  A hacky work around would be the following...
> 
> #+headers: :epilogue "})" #+headers: :prologue "local({" 
> #+begin_src R  :results output :session cat("Test") #+end_src

Thanks - that looks fine to me for the moment. I whould use these
#+headers: much more often - they clean up the #+begin_src line and IU
actually like it.

Cheers,

Rainer

> 
> Best,
> 
>> 
>> 
>> * test 2 #+begin_src R  :results output :prologue "cat(1,
>> '###\n')" :epilogue "cat(2, '###\n')" :session cat("Test\n") 
>> #+end_src
>> 
>> #+RESULTS: : 1 ### : Test
>> 
>> works under :session and without
>> 
>> but * test 2 #+begin_src R  :results output :prologue "{cat(1, 2
>> )"   :epilogue "cat(2, 3)}" :session cat("Test\n") #+end_src
>> 
>> works only without :session as R is waiting for the "}" which is
>> in the :epilogue but which is not added.
>> 
>> Cheers,
>> 
>> Rainer
>> 
>> 
>>> 
>>> Best,
>>> 
>>>> 
>>>> But the problem seems to be the unbalanced brackets, and
>>>> everything is passed on as the prologue, as I get the error:
>>>> 
>>>> Error: unexpected ':' in: "{ local({  :" Execution halted
>>>> 
>>>> Can I somehow use unbalanced brackets, or is this a missing
>>>> option in epilogue and prologue?
>>>> 
>>>> Cheers,
>>>> 
>>>> Rainer
>>>> 
>>>> 
>>>> -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc
>>>> (Conservation Biology, UCT), Dipl. Phys. (Germany)
>>>> 
>>>> Centre of Excellence for Invasion Biology Stellenbosch
>>>> University South Africa
>>>> 
>>>> Tel :       +33 - (0)9 53 10 27 44 Cell:       +33 - (0)6 85
>>>> 62 59 98 Fax :       +33 - (0)9 58 10 27 44
>>>> 
>>>> Fax (D):    +49 - (0)3 21 21 25 22 44
>>>> 
>>>> email:      Rainer@krugs.de
>>>> 
>>>> Skype:      RMkrug
>>> 
>> 
>> -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc
>> (Conservation Biology, UCT), Dipl. Phys. (Germany)
>> 
>> Centre of Excellence for Invasion Biology Stellenbosch
>> University South Africa
>> 
>> Tel :       +33 - (0)9 53 10 27 44 Cell:       +33 - (0)6 85 62
>> 59 98 Fax :       +33 - (0)9 58 10 27 44
>> 
>> Fax (D):    +49 - (0)3 21 21 25 22 44
>> 
>> email:      Rainer@krugs.de
>> 
>> Skype:      RMkrug
> 

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS5iPZAAoJENvXNx4PUvmCA+oIAM3qK1QljWs2d7gvTxY1Np7c
DcbZn6GE3OD1mYMiNLZVCZ9mYthSOPYNTrXQDxo90hcodkfXQarUKWp7vaBZOwUA
uEasOGdq3GAwK1EwvuetQwlSdLDufsO7jbJsT+xbm+gRNF+DqvUBqcrhI071xZvU
Wv284oX00Mknd2OxEmKKCUtHd+timu2QfEGTyT+zYaWULY3CfBN8WyPxDdneHQIC
ea534F7qqP9QPIMcsYfVAGlHEwcTtnDvrBdsaW5WpgmQYj6UU7k9gH61aBMKZP7f
IC7zITlAf+EeVIg8T1GZ3pZXoWshAzbdiK3LoFJ56fzCdGa83Ywbb55TIzuVulw=
=aXYx
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-27  9:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-20 14:11 [babel] Using :prologue and :epilogue with unbalanced brackets Rainer M Krug
2014-01-20 15:34 ` Eric Schulte
2014-01-21 10:28   ` Rainer M Krug
2014-01-26 18:16     ` Eric Schulte
2014-01-27  9:16       ` Rainer M Krug

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).