From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wJdZNUsf5WAgGAAAgWs5BA (envelope-from ) for ; Wed, 07 Jul 2021 05:28:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iHQsMUsf5WBQagAAB5/wlQ (envelope-from ) for ; Wed, 07 Jul 2021 03:28:11 +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 B561CD1FB for ; Wed, 7 Jul 2021 05:28:10 +0200 (CEST) Received: from localhost ([::1]:34710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0yEL-0003Il-Ov for larch@yhetil.org; Tue, 06 Jul 2021 23:28:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0yDi-0003AI-Ip for emacs-orgmode@gnu.org; Tue, 06 Jul 2021 23:27:30 -0400 Received: from forward103o.mail.yandex.net ([2a02:6b8:0:1a2d::606]:32880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0yDf-0007YR-NS for emacs-orgmode@gnu.org; Tue, 06 Jul 2021 23:27:30 -0400 Received: from sas1-299d7dae1406.qloud-c.yandex.net (sas1-299d7dae1406.qloud-c.yandex.net [IPv6:2a02:6b8:c14:399e:0:640:299d:7dae]) by forward103o.mail.yandex.net (Yandex) with ESMTP id 1037A5F8090D; Wed, 7 Jul 2021 06:27:21 +0300 (MSK) Received: from sas2-e7f6fb703652.qloud-c.yandex.net (sas2-e7f6fb703652.qloud-c.yandex.net [2a02:6b8:c14:4fa6:0:640:e7f6:fb70]) by sas1-299d7dae1406.qloud-c.yandex.net (mxback/Yandex) with ESMTP id wRavxSV3Uh-RKIOvNUm; Wed, 07 Jul 2021 06:27:21 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1625628441; bh=fEMJoJ6YL77ScylfuKF58fz5E5hWVzjSlgorEeSvKTQ=; h=In-Reply-To:Subject:Cc:To:From:References:Date:Message-ID; b=mKJUhFBh/XgN30MJoINDPxl7sdhG2+0sLb+SgWtM2NjwrgJ5j4t/10K6rfx6wdIdu 11oTlkBCfkb05D2dWKq5GNlhB21g+GfKfHH4XvUFNa4Y769gb7zEhq0OXN4uycnKdE z0y/3OsbQ2rK6z+AXOq8sekQxrj3GGbq9FN/MHec= Received: by sas2-e7f6fb703652.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id F6zuIybEfa-RKQKbEQs; Wed, 07 Jul 2021 06:27:20 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Received: by smoon.bkoty.ru (Postfix, from userid 1000) id 4GKPxL6trwz8xq; Wed, 7 Jul 2021 11:27:18 +0800 (+08) Date: Wed, 7 Jul 2021 11:27:18 +0800 From: Vladimir Lomov To: Jacopo De Simoi Subject: Re: [PATCH] Allow tangling to a list of files Message-ID: References: <-0ZoEP_lzUvrnWSq9TwiYHNJ0Spa94xjiTOF0TU8np0pYgHEPx-62_dr5xBMd3VUu7frSRXxiAFje99v2jeaJg==@protonmail.internalid> <3xziDF9qTEWTCnFZdoXRlffWkusi5xR4Rcrp-7A0mXpDHI11TIQoxfgNAoygPMIK52EZ7hZfRpb8YnTDQ4RosA==@protonmail.internalid> <4139848.ejJDZkT8p0@bl4ckspoons> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="POUSfcIkTTiHS8x9" Content-Disposition: inline In-Reply-To: <4139848.ejJDZkT8p0@bl4ckspoons> Received-SPF: pass client-ip=2a02:6b8:0:1a2d::606; envelope-from=lomov.vl@yandex.ru; helo=forward103o.mail.yandex.net 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, SPF_HELO_NONE=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: , Cc: Greg Minshall , emacs-orgmode@gnu.org 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=1625628491; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=fEMJoJ6YL77ScylfuKF58fz5E5hWVzjSlgorEeSvKTQ=; b=kx0fd/Q/EDqshcbN34sdnG886eCiwz2nRlmQQ9CALZDdms3iItxdQwxSknCWkFRcdNFFzG /DhAQIMy/KHASoPn1UDhYFwVRgevoylQufLXLOUF11GfvLrS8OPSPKPHaRxAxJ2Yy12bYh PmI/osytli8YGjwcr/20BckEfE1yKGAUonlgAn0Lb1vK7EZGXZd++kR0ICWNxzck3oOZVz eVxYCP5EU1xg6yJMCTS8vnwDhd550qpzZT4Fdak987QnGgZr/8wA90+EiSJCkWrrJM29Jq bJcTUX9uWVnr8gngV1IG7Ka1fBTVlcro/8C53LjGHjdlQwNWr6m9Q1dTm97gSQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625628491; a=rsa-sha256; cv=none; b=b2Q7aYkW7poi4Hp9w4UbXsgtnOB04e0JHmAxWsUmyYgRl4MDx5AlA4YhHE6B7mK1ADcTGd x0IPpIOa4DnGRD9Rwkb/AjZ0D39iB7Pnmzp6FZRob6eH/axKL4terbGEUuZRlBJ7jKROLC BWh9+3ONLUCL17Z48IZerLT9mqj/7iXDHHs1WsYj21uH+s5NgUvWHMw2Yaeb6wv1Up+7Uc Nk/Pz0woFyasQGjdHc/cdg8A0TgMCaBa/3y4ejoBkWcz99i/z2gEWnJFe07ORDErkOSHzP ceqsnvLFM69xLNQ38Ij5LDNrnhkBNU9m8bPYektxQpAYByXg93LhM5fHgXu3fQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=yandex.ru header.s=mail header.b=mKJUhFBh; dmarc=pass (policy=none) header.from=yandex.ru; 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: -5.21 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=yandex.ru header.s=mail header.b=mKJUhFBh; dmarc=pass (policy=none) header.from=yandex.ru; 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: B561CD1FB X-Spam-Score: -5.21 X-Migadu-Scanner: scn0.migadu.com X-TUID: kx4oZeM5tive --POUSfcIkTTiHS8x9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Jacopo. ** Jacopo De Simoi [2021-07-06 11:24:40 -0400]: > Dear Vladimir,=20 > thanks for your reply. > Let me show you two examples; they are both WIP and incomplete, but you'l= l get=20 > the gist.=20 > - 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 some > blocks are present and other are not)=20 I couldn't find in Org manual how tangling should work if there are several 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 two 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 than 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 source file is derived from the name of the Org file, and the file extension 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 from 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 code block") will be tangled (exported) to a source file. What Org will do if th= ere are several source blocks? Concatenate them or write to a file only last on= e? (I didn't test that). The same applies to 'FILENAME' case: what Org will do if there are several 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. > - Example 2 > https://gist.github.com/2bce5d6df3f04c934fb4beda0c6560ad > This is my literate config for xkb maps; I have several keyboards, and so= me of=20 > them require slightly different maps. > Once again, likely all this can be accomplished by some noweb magic, but = I find=20 > my approach much less intrusive (particularly the initial bit in the .zsh= rc,=20 > which I am still refactoring, where the list of tangle targets is inferre= d=20 > from the headline tags) I found you way of doing things a bit strange. As I already told I use 'now= eb' 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 same > with noweb and compare my approach with the "standard" one. Once more, I > hope these examples clarify my point of view.=20 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=20 > Jacopo [...] --- WBR, Vladimir Lomov --=20 str->str_pok |=3D SP_FBM; /* deep magic */ s =3D (unsigned char*)(str->str_ptr); /* deeper magic */ -- Larry Wall in util.c from the perl source code --POUSfcIkTTiHS8x9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQQaopaKwcQWyz7yQfAHGfInzJc4BQUCYOUfDwAKCRAHGfInzJc4 BbG7AP0e4jgeXJd6OybMOi8ncvmN2SW2ZZORM0/qt3ajqNNTSwD/eW6hoc5IBNYN pBBwqYvWnPCIm/SXowg/Js/qD5YDWg4= =1d4r -----END PGP SIGNATURE----- --POUSfcIkTTiHS8x9--