From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: [babel] Using :prologue and :epilogue with unbalanced brackets Date: Mon, 27 Jan 2014 10:16:10 +0100 Message-ID: <52E623DA.2000904@krugs.de> References: <52DD2E8A.704@krugs.de> <87ha8yy8c1.fsf@gmail.com> <52DE4BBD.4090807@krugs.de> <87ppnewnzf.fsf@gmail.com> Reply-To: Rainer@krugs.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7iIk-00035T-AV for Emacs-orgmode@gnu.org; Mon, 27 Jan 2014 04:16:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7iIe-0001yT-SQ for Emacs-orgmode@gnu.org; Mon, 27 Jan 2014 04:16:18 -0500 Received: from mail-we0-f175.google.com ([74.125.82.175]:56196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7iIe-0001yP-Il for Emacs-orgmode@gnu.org; Mon, 27 Jan 2014 04:16:12 -0500 Received: by mail-we0-f175.google.com with SMTP id p61so4887655wes.20 for ; Mon, 27 Jan 2014 01:16:12 -0800 (PST) In-Reply-To: <87ppnewnzf.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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 writes: > >> On 01/20/14, 16:34 , Eric Schulte wrote: >>> Rainer M Krug 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-----