From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IFWsM3o15WDpNgAAgWs5BA (envelope-from ) for ; Wed, 07 Jul 2021 07:02:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +LNbL3o15WC6LwAAB5/wlQ (envelope-from ) for ; Wed, 07 Jul 2021 05:02:50 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9ED5CE844 for ; Wed, 7 Jul 2021 07:02:49 +0200 (CEST) Received: from localhost ([::1]:48182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0zhv-0001aI-G5 for larch@yhetil.org; Wed, 07 Jul 2021 01:02:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0zhN-0001a4-Vs for emacs-orgmode@gnu.org; Wed, 07 Jul 2021 01:02:13 -0400 Received: from mail-4323.protonmail.ch ([185.70.43.23]:20747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0zhK-0005xi-Pc for emacs-orgmode@gnu.org; Wed, 07 Jul 2021 01:02:13 -0400 Date: Wed, 07 Jul 2021 05:01:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1625634125; bh=uzEkQSUqqWZtFhwrSHR+iX/L04aXmw86ypMkwsSWf54=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=iiB9j8R0olsuI51hadTo576osU9gwD9/oQ0YhPHvXYrS9uuj+WvCusNuOKnOhB3by ePSVZdaY45PUXKgiaWutlPQzLsBEv4GroHDPg2Qh3HaRaOz5SxQsuWrIl2pDaUiWkx cOvpREsskOPXUreZC9/IAX1/h72sY5OnDNz0rroE= To: Vladimir Lomov From: Jacopo De Simoi Cc: Greg Minshall , emacs-orgmode@gnu.org Subject: Re: [PATCH] Allow tangling to a list of files Message-ID: <2202345.ElGaqSPkdT@bl4ckspoons> In-Reply-To: References: <-0ZoEP_lzUvrnWSq9TwiYHNJ0Spa94xjiTOF0TU8np0pYgHEPx-62_dr5xBMd3VUu7frSRXxiAFje99v2jeaJg==@protonmail.internalid> <3xziDF9qTEWTCnFZdoXRlffWkusi5xR4Rcrp-7A0mXpDHI11TIQoxfgNAoygPMIK52EZ7hZfRpb8YnTDQ4RosA==@protonmail.internalid> <4139848.ejJDZkT8p0@bl4ckspoons> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.43.23; envelope-from=wilderjds@protonmail.com; helo=mail-4323.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jacopo De Simoi Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625634170; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=uzEkQSUqqWZtFhwrSHR+iX/L04aXmw86ypMkwsSWf54=; b=GruOemhn5LrtKOcA9AaPY9q/fOhi64uDZCoy8xlIVGuopBF4ZrxeDveBGF2NWVbXvCzY1a dnfRmY61JaSpMOkmvtTvUVDuF5CZMUnWKSsnRxGeF+e2hvfFz3MM84ZLl1gOrCKhsoRGiQ BrMuRcR27gDXZpoK4PrcdP7q0ShQ49X847PQFpVwHTPQtinGbeMthpST3N7SJOcBw36vd+ CcVJpeicvR/TFJzYTG4aREUTlMRyqsRpbUQcVKPkN8pZKUxdGF7SdsZGAj/o/CxmSFggUy 0d7yfmH9xMHxzMlNHX9TrYUcFhRI4Y85CRJknYuyA1izusJes2K5kIXxapqxQA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625634170; a=rsa-sha256; cv=none; b=u7MpWyr7c/hFQlEBY88nFC9up9/dEjHugm+EADo61c5mZL2OV1AjiVd0KPtSmTwKODw7RT ETr34d+/ONkZNYVS9aYGAv59aYZayLRgN3X5dbwHqP6Hli6/o0N4st+TNvVpFl5ibopbT8 nsASbxBeT/I4aMd9+VkK9RauD8Lc3JB+tYXg+Vmkpu7oNPlWvvueDcK1LA00cX6UBMWer5 LOZP31UlRZ2ILRnuGkwR/HTYEu7/c9A1yZwP4g9vSI6cPgDkLVD+9QHpJD4GkL9VM2CQDL kcP/dfJvu/15HY97InG3eNxWyAMCmjyLeR10WVETIvbZet+4lDtQJgade0Ehgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail header.b=iiB9j8R0; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.61 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail header.b=iiB9j8R0; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 9ED5CE844 X-Spam-Score: -2.61 X-Migadu-Scanner: scn0.migadu.com X-TUID: mjZ9sBeS6ZEj On Tuesday, July 6, 2021 11:27:18 PM EDT Vladimir Lomov wrote: > Hello Jacopo. > > ** Jacopo De Simoi [2021-07-06 11:24:40 -0400]= : > > Dear Vladimir, > > > > thanks for your reply. > > > > Let me show you two examples; they are both WIP and incomplete, but you= 'll > > get the gist. > > > > - Example 1 > > > > https://gist.github.com/85c9b9c9ab151c5fd35bd761ef6ef569 > > > > This is my literate config for .zshrc; as you can see different blocks = are > > tangled to different set of files; hence the output files differ (as so= me > > blocks are present and other are not) > > I couldn't find in Org manual how tangling should work if there are sever= al > source code blocks with the same file name for ':tangle'. The Org manual > section "15.8 Extracting Source Code" is a bit obscure. There are these t= wo > sentences > > When Org tangles code blocks, it expands, merges, and transforms > them. Then Org recomposes them into one or more separate files, as > configured through the options. > > The second sentence assumes that it might be possible to tangle to more t= han > one file but possible options for ':tangle' don't give certain answer: > > yes=E2=80=99 > > Export the code block to source file. The file name for the sourc= e > file is derived from the name of the Org file, and the file extens= ion > is derived from the source code language identifier. > Example: =E2=80=98:tangle yes=E2=80=99. > > FILENAME > > Export the code block to source file whose file name is derived fr= om > any string passed to the =E2=80=98tangle=E2=80=99 header argument.= Org derives the > file name as being relative to the directory of the Org file= =E2=80=99s > location. Example: =E2=80=98:tangle FILENAME=E2=80=99. > > If I understand first choice correctly then the only source block ("the c= ode > block") will be tangled (exported) to a source file. What Org will do if > there are several source blocks? Concatenate them or write to a file only > last one? (I didn't test that). > > The same applies to 'FILENAME' case: what Org will do if there are severa= l > source code blocks with the same 'FILENAME' for ':tangle'. > > I would say that you use here undocumented feature and you workflow could= be > broken if in some future Org version developers decide to implement only > documented features. I am quite sure that if more than one blocks are tangled to the same file, = then the blocks must be concatenated. There is at least one test in the test su= ite which is designed to check precisely this behavior. > > > - Example 2 > > > > https://gist.github.com/2bce5d6df3f04c934fb4beda0c6560ad > > > > This is my literate config for xkb maps; I have several keyboards, and > > some of them require slightly different maps. > > > > Once again, likely all this can be accomplished by some noweb magic, bu= t I > > find my approach much less intrusive (particularly the initial bit in t= he > > .zshrc, which I am still refactoring, where the list of tangle targets = is > > inferred from the headline tags) > > I found you way of doing things a bit strange. As I already told I use > 'noweb' feature a lot. I won't advise you to use it or not to use it but = I > find it very powerful. > > > Thanks again for your comments. I'd really like to see how to do the sa= me > > with noweb and compare my approach with the "standard" one. Once more, = I > > hope these examples clarify my point of view. > Thanks, I will certainly have a good look. > If you don't distract by foreign language (Russian) you could look how I = use > 'noweb' feature for scripts (one example): > > https://git.sr.ht/~vp1981/scripts/tree/master/item/docs/scripts/misc.org > > for shell configurations: > > https://git.sr.ht/~vp1981/scripts/tree/master/item/docs/shell/bash.org > > and for Emacs configuration: > > https://git.sr.ht/~vp1981/scripts/tree/master/item/docs/emacs/emacs.org > > > Best > > > > Jacopo > > [...] > > --- > WBR, Vladimir Lomov