From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Tangling from code block and header arguments WAS: Format output of org-babel-tangle for exported file Date: Wed, 03 Sep 2014 17:46:04 +0200 Message-ID: References: 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]:33889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPClL-0006qT-MW for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 11:46:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPClG-0003Iu-OV for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 11:46:23 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:58243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPClG-0003IM-Hd for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 11:46:18 -0400 Received: by mail-wi0-f178.google.com with SMTP id r20so10042271wiv.11 for ; Wed, 03 Sep 2014 08:46:15 -0700 (PDT) In-Reply-To: (Charles Berry's message of "Wed, 3 Sep 2014 14:19:19 +0000 (UTC)") 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: Charles Berry Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Charles Berry writes: > Rainer M Krug krugs.de> writes: > >>=20 >> Hi >>=20 >> I am calling (org-bable-tangle) in a code block in an org file and I >> would show the files resulting from the tangling in a nice format. >>=20 >> But I do not manage. I have the following at the moment: >>=20 >> --8<---------------cut here---------------start------------->8--- >> #+begin_src emacs-lisp=20 >> (replace-regexp-in-string "[)\"]" "" >> (replace-regexp-in-string "[(]" "- " >> (replace-regexp-in-string " " "\n- " >> (prin1-to-string (org-babel-tangle))))) >> #+end_src >>=20 > > [snip] > >> Which is neither elegant nor short, and I am sure I could do this >> easier. Any suggestions? > > Something like this? Possibly with `(reverse (org-babel-tangle))' > > #+BEGIN_SRC emacs-lisp :results value > (mapconcat (lambda (x) (file-relative-name x "..")) (org-babel-tangle) "\= n") > #+END_SRC Thanks - this looks promising. But I now have another problem: The result of tangling from a code block is different then when calling interactively. Consider the following org file: =2D-8<---------------cut here---------------start------------->8--- #+PROPERTY: header-args :tangle no * DESCRIPTION File :PROPERTIES: :header-args+: :tangle ./DESCRIPTION :END: #+begin_src RDescr test #+end_src * And the tangling #+BEGIN_SRC emacs-lisp :results value (mapconcat (lambda (x) (file-relative-name x "..")) (org-babel-tangle) "\n") #+END_SRC #+RESULTS: =2D-8<---------------cut here---------------end--------------->8--- When tangling interactively, the file DESCRIPTION is tangled properly. But when I call (org-babel-tangle) from the code block, nothing is tangled because in this case, the property =3Dtangle=3D is equal to =3Dno=3D based on the file wide property setting in the beginning. Is this a bug or is it simply not possible to tangle from a code block? Thanks, Rainer > > > HTH, > > Chuck > > > > =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJUBzfAAAoJENvXNx4PUvmCIJoIALBDs/RBXge/mJAOkNc51UA2 6Z7Uhs/h5/kQGeaWi2sVd42BIOHGMmCBaG4w2NU1PgATaxNSPa40ov2qJO61tVhM 7weBYOOCa/Gnv6hIK0o8fvs1elhwdXD+2WAj7Mcupmj44bvG4OKbsWaLw4HpTIYV iloLYgvZcLfC5b7k/gYIImc9rQKW0qFA1iWjv2KZ8HT+HCWQ2jiZhvXcRkezArOk rE/S3G4jIlVMzpR+bkdDufgGhC8tspmUyngb+hlQnr59Ypm7V6j1lCAvJnVfr9TC 6ryRV+9+xW3ofDThbtcZVx+ayGB/VoGYmZMam1KKL36usdMTYzKKS5rABodaG8k= =KF17 -----END PGP SIGNATURE----- --=-=-=--