From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: selective tangling? Date: Thu, 29 Nov 2018 08:10:09 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000b2e550057bcd673d" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSM5J-0000Az-3n for emacs-orgmode@gnu.org; Thu, 29 Nov 2018 08:10:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSM5I-0000pq-0p for emacs-orgmode@gnu.org; Thu, 29 Nov 2018 08:10:25 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:33811) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSM5H-0000pF-PD for emacs-orgmode@gnu.org; Thu, 29 Nov 2018 08:10:23 -0500 Received: by mail-wm1-x32e.google.com with SMTP id y185so6355050wmd.1 for ; Thu, 29 Nov 2018 05:10:23 -0800 (PST) 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" To: org-mode-email --000000000000b2e550057bcd673d Content-Type: text/plain; charset="UTF-8" Are there any ways to selectively tangle blocks? By that I mean suppose there are a dozen src blocks in a file, but I want to selectively tangle only a few of them, selecting them by a tag, for example, or some other property. These might have mixed languages, e.g. a config files, a python script, and a makefile. The use case here is I have an org document that I use to document a simulation. The simulation has several config files, and a makefile, and there is a python script that does analysis. I like to put all of these in src blocks and then use a sh block to run the actual simulation command. I usually put a :var a=(org-babel-tangle) header in the sh block, which makes sure the files are tangled, and then runs the shell commands. But this tangles all the files in the buffer, which is usually not what I want (there are sometimes multiple simulations described in one file). The blocks are not always in one subtree, so it isn't a matter of just narrowing, and they are mixed languages (text, make, python, etc.) and target files so I can't just target one file. The only mechanism for this i have come up with is to use org-babel-map-src-blocks to run a check on each block to see if it matches my tangle criteria and then run (org-babel-tangle t) on that block. This seems to work fine, but I thought I would check if anyone else has a better solution. John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu --000000000000b2e550057bcd673d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Are there any ways to selectively tangle blocks?

<= /div>
By that I mean suppose there are a dozen src blocks in a file, bu= t I want to selectively tangle only a few of them, selecting them by a tag,= for example, or some other property. These might have mixed languages, e.g= . a config files, a python script, and a makefile.

The use case here is I have an org document that I use to document a simul= ation. The simulation has several config files, and a makefile, and there i= s a python script that does analysis. I like to put all of these in src blo= cks and then use a sh block to run the actual simulation command. I usually= put a :var a=3D(org-babel-tangle) header in the sh block, which makes sure= the files are tangled, and then runs the shell commands. But this tangles = all the files in the buffer, which is usually not what I want (there are so= metimes multiple simulations described in one file).=C2=A0 The blocks are n= ot always in one subtree, so it isn't a matter of just narrowing, and t= hey are mixed languages (text, make, python, etc.) and target files so I ca= n't just target one file.

The only mechanism f= or this i have come up with is to use org-babel-map-src-blocks to run a che= ck on each block to see if it matches my tangle criteria and then run (org-= babel-tangle t) on that block. This seems to work fine, but I thought I wou= ld check if anyone else has a better solution.

John

-= ----------------------------------
Professor John Kitchin=C2=A0
Doher= ty Hall A207F
Department of Chemical Engineering
Carnegie Mellon Univ= ersity
Pittsburgh, PA 15213
412-268-7803
<= /div>
--000000000000b2e550057bcd673d--