From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: =?UTF-8?B?UmU6IMKrTWFjcm/CuyBleHBhbnNpb24gaW4gc291cmNlIGJsb2Nr?= =?UTF-8?B?czsgY29kZS1zaGFyaW5nIGJldHdlZW4gYmxvY2tz?= Date: Fri, 19 Sep 2014 11:04:26 +0200 Message-ID: References: <87bnqdqb7i.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUu7O-0004PN-RJ for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 05:04:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUu7I-0006IU-Sp for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 05:04:42 -0400 Received: from mail-we0-f175.google.com ([74.125.82.175]:56517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUu7I-0006HS-Kt for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 05:04:36 -0400 Received: by mail-we0-f175.google.com with SMTP id w61so2106351wes.6 for ; Fri, 19 Sep 2014 02:04:31 -0700 (PDT) In-Reply-To: (Andreas Kiermeier's message of "Fri, 19 Sep 2014 09:14:46 +0930") 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: Andreas Kiermeier Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Andreas Kiermeier writes: > I don't think you need the ":noweb yes" as part of the setup_fu > header, as this block is not pulling in other materials. > > Having used this type of setup only over the last couple of days, I've > come up with another question. It appears that the setup_fu is > executed twice ... once as it's own source block (though by itself not > need) and once as part of the second noweb block. This isn't a problem > if the execution time is small, but I'm trying to create a summary > table in Latex format from 2 million records - so the time is > considerable. > Check out the :eval header argument: if you use=20 ,---- | #+BEGIN_SRC R :eval never :exports none `---- this block is never executed - this should work. There are also other values for :eval. From the help: ,---- | 14.8.2.25 `:eval' | ................. |=20 | The `:eval' header argument can be used to limit the evaluation of | specific code blocks. The `:eval' header argument can be useful for | protecting against the evaluation of dangerous code blocks or to ensure | that evaluation will require a query regardless of the value of the | `org-confirm-babel-evaluate' variable. The possible values of `:eval' | and their effects are shown below. |=20 | `never or no' | The code block will not be evaluated under any circumstances. |=20 | `query' | Evaluation of the code block will require a query. |=20 | `never-export or no-export' | The code block will not be evaluated during export but may still | be called interactively. |=20 | `query-export' | Evaluation of the code block during export will require a query. |=20 | If this header argument is not set then evaluation is determined by | the value of the `org-confirm-babel-evaluate' variable see *Note Code | evaluation security::. `---- Cheers, Rainer > My two blocks (with some code removed for simplicity) are as follow: > > #+NAME: tbl-refyear > #+BEGIN_SRC R :results silent :exports none > latex(tabular( )) > #+END_SRC > > #+BEGIN_SRC latex :noweb yes > \begin{table}[h] > \label{tbl:refyear} > \caption{Separation outcomes (death or any type of discharge) by > reference year.} > <> > \end{table} > #+END_SRC > > I've tried :cache yes as part of the tbl-refyear source block, but > that didn't stop if from being run twice. Am I missing a suitable > header argument? > > This is the only way I could find to wrap the latex table (which has > some complex formatting and hence why I've used it over just producing > a table) in a float with a caption (though I still can't properly > reference the label when I export to a PDF file). > > Any thought would be greatly appreciated. TIA! > > Andreas > > On 18 September 2014 23:31, Eric S Fraga wrote: >> >> On Thursday, 18 Sep 2014 at 13:26, Tobias Getzner wrote: >> > On Thu, 18 Sep 2014 13:17:14 +0000, Tobias Getzner wrote: >> > >> >> Are there any convenient inline-expansion methods I might have >> >> overlooked? >> > >> > To illustrate, I was wondering if any of the following is feasible >> > somehow: >> >> Yes, and you almost got it right with your syntactic expansion: >> >> #+begin_src org >> >> ,* Syntactic expansion >> >> ,#+name: setup_fu >> ,#+begin_src sh :noweb yes >> echo 2 >> ,#+end_src >> >> ,#+begin_src sh :results raw :noweb yes >> echo 1 >> <> >> echo 3 >> ,#+end_src >> >> ,#+results: >> 1 >> 2 >> 3 >> >> #+end_src >> >> Org src blocks can reference other src blocks. Note the ":noweb yes" >> option and the use of <<...>>. >> >> >> -- >> : Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-366-gb= 2fca7 > > =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJUG/GbAAoJENvXNx4PUvmCAfQH/2kvLFyxGrY/Fuxhz1a2c25h NXtONdK5WB3K/i93D3W8u2raAEsSdoJPWFUXxsUGuKTlZMGkjkvRJG8r4R0JUgeF TmaPPK6oU1wp6T9bBuHa6dH03Mhsvt6DrYkuMp5zn8YdJnAxkrv+eLmr8WxA5jwv WutVfNkCdFQUpAMuna2Ds68NRnZPuiZBUVAEZ/JHvzIqAD8eneY9f+Exlw/maTZI oOyx3+XRv4NS+2Y+O9qxWPtI3wnQsfLiJZ+I0PsVA12N2SaLMaLjYHhtPP3ebMCV ONIRvlqroyLrtO82vFUcN+5PHik6+WS3BZWh1B98U7rbveoaGiF2spF2qy7l3IY= =oCam -----END PGP SIGNATURE----- --=-=-=--