From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Berry, Charles" Subject: Re: selective tangling? Date: Thu, 29 Nov 2018 16:44:10 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSPQJ-0006sc-H0 for emacs-orgmode@gnu.org; Thu, 29 Nov 2018 11:44:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSPQE-0002XF-Hm for emacs-orgmode@gnu.org; Thu, 29 Nov 2018 11:44:19 -0500 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:33108) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSPQE-0002Wd-19 for emacs-orgmode@gnu.org; Thu, 29 Nov 2018 11:44:14 -0500 In-Reply-To: Content-Language: en-US Content-ID: 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: John Kitchin Cc: org-mode-email > On Nov 29, 2018, at 5:10 AM, John Kitchin wrote= : >=20 > Are there any ways to selectively tangle blocks? >=20 > 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 exa= mple, or some other property. These might have mixed languages, e.g. a conf= ig files, a python script, and a makefile. >=20 > The use case here is I have an org document that I use to document a simu= lation. 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 bl= ocks and then use a sh block to run the actual simulation command. I usuall= y put a :var a=3D(org-babel-tangle) header in the sh block, which makes sur= e 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 s= ometimes multiple simulations described in one file). The blocks are not a= lways 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. >=20 > The only mechanism for this i have come up with is to use org-babel-map-s= rc-blocks to run a check on each block to see if it matches my tangle crite= ria and then run (org-babel-tangle t) on that block. This seems to work fin= e, but I thought I would check if anyone else has a better solution. >=20 >=20 Use the :tangle header arg with your check function and its args: :tangle (my-tangle-selector ...) HTH, Chuck