From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philip Hudson Subject: Tangling flow control Date: Tue, 8 Nov 2016 21:21:50 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4DqP-00064E-Fd for emacs-orgmode@gnu.org; Tue, 08 Nov 2016 16:22:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4DqO-0000LZ-FZ for emacs-orgmode@gnu.org; Tue, 08 Nov 2016 16:22:13 -0500 Received: from mail-vk0-x233.google.com ([2607:f8b0:400c:c05::233]:36367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c4DqO-0000LA-AC for emacs-orgmode@gnu.org; Tue, 08 Nov 2016 16:22:12 -0500 Received: by mail-vk0-x233.google.com with SMTP id p9so160158229vkd.3 for ; Tue, 08 Nov 2016 13:22:11 -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: emacs orgmode-mailinglist Thanks to Charles Berry and the "scraps" site curated by Eric Schulte (is he on the list?), I now know how to do "branching" flow control when tangling, by using a form that evals to either "no" or a filename as the argument to the =:tangle= header. How do you do "looping" flow control? For context, what I'm trying to write is a single Org file from which I can tangle out a number of =~/.ssh/config= files, one for each of several hosts on a LAN. Within this file I need to repeatedly place a template =BEGIN_SRC ssh-config= block, each time with a few words and numbers changed. Do you do this anywhere? If so, how have you implemented it? I'm already at the point where I can do a dumb, brute-force version with lots of near-identical blocks that I know will give me what I need, so that's fine, but I like to keep things DRY. It occurs to me that looping may simply not be what tangling is for, and I need to look at levels of indirection. That is, tangle to a bunch of intermediate Org files each of which tangles to a config file: is that what you would recommend? Or transclude an Org file containing my block template and perhaps somehow use tags and =org-get-tags-at= to parameterize each inclusion? Anyone already doing something like that? -- Phil Hudson http://hudson-it.ddns.net Pretty Good Privacy (PGP) ID: 0x887DCA63