From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: tangle on export Date: Thu, 24 Sep 2015 13:17:38 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4X8-0003e7-7b for emacs-orgmode@gnu.org; Thu, 24 Sep 2015 07:17:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf4X5-0005G9-1F for emacs-orgmode@gnu.org; Thu, 24 Sep 2015 07:17:50 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4X4-0005Fp-Rv for emacs-orgmode@gnu.org; Thu, 24 Sep 2015 07:17:46 -0400 Received: by wiclk2 with SMTP id lk2so23288454wic.0 for ; Thu, 24 Sep 2015 04:17:46 -0700 (PDT) In-Reply-To: (Alan Schmitt's message of "Thu, 24 Sep 2015 12:37:58 +0200") 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: Alan Schmitt Cc: emacs-orgmode --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Alan Schmitt writes: > Hello, > > I have a question I feel is very basic but I did not find the answer in > the manual. How can I trigger the tangling of a block upon export. Tangling and exporting are two different paths (well - one could see tangling as a special case of exporting). You have to use an export hook (see http://orgmode.org/tmp/worg/org-configs/org-hooks.html for a list of hooks in org). I have done something similar to run a post-tangle hook: #+begin_src emacs-lisp (defvar org-babel-tangle-run-postTangleScript nil "If non-nil, postTangleScript.sh will be executed") (put 'org-babel-tangle-run-postTangleScript 'safe-local-variable 'booleanp) (defun org-babel-run-post-tangle-script () (when org-babel-tangle-run-postTangleScript (message "running the postTangleScript.sh bash shell script") (shell-command "bash ./postTangleScript.sh"))) (add-hook 'org-babel-post-tangle-hook 'org-babel-run-post-tangle-script) #+end_src Cheers, Rainer > > More precisely, I want to give the following example in a lecture: > > #+name:hello > #+begin_src ocaml :tangle myprog.ml > Printf.printf "Bonjour le monde !\n" > #+end_src > #+BEGIN_SRC sh :exports both :results verbatim > ocamlc -o myprog myprog.ml > ./myprog > #+END_SRC > > where I show a program to be compiled and actually compile it. Is there > a header I should put on the "hello" block to tangle it when I export > it? > > Thanks, > > Alan =2D-=20 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 PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJWA9vWAAoJENvXNx4PUvmC4m8H/AtPjptoNs7tcHTDc3Icy7wU G4aLA2Xb+pXCYMYAeB54YCE/6TOd9R2m6TTZoKzIr14oLsfbRQv1HnIhUyOgLd7l KMgiCsMCZE5n7cWPn/4DEzC16HB45vwjjjfKTQ08ZEGEI+QBFGoY/oKF8o2WfHQi OfaQBUBQcr3cA673YAFLzC3kMZeXXiIc5uHIZOHAgmpyJw5pRDrf8ZJEau2BI81E f6gcrSuTt4I5I4/r3hSRg9TKoO5cCQ6lVEYfuLv8McWCpjO6ck4zX66sQwYtfcpc Heh7T50b+1O3XtxWSAPrEHSX59Q3K3BfmTQO+YCZQ4RR5pKVyiQ8NgQuCr8GZwk= =WkE+ -----END PGP SIGNATURE----- --=-=-=--