From: Jacopo De Simoi <wilderjds@protonmail.com>
To: Vladimir Lomov <lomov.vl@yandex.ru>
Cc: Greg Minshall <minshall@umich.edu>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Allow tangling to a list of files
Date: Wed, 07 Jul 2021 05:01:55 +0000 [thread overview]
Message-ID: <2202345.ElGaqSPkdT@bl4ckspoons> (raw)
In-Reply-To: <YOUfFkpiALvzO8fg@smoon.bkoty.ru>
On Tuesday, July 6, 2021 11:27:18 PM EDT Vladimir Lomov wrote:
> Hello Jacopo.
>
> ** Jacopo De Simoi <wilderjds@protonmail.com> [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 some
> > blocks are present and other are not)
>
> 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’
>
> 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: ‘:tangle yes’.
>
> FILENAME
>
> Export the code block to source file whose file name is derived from
> any string passed to the ‘tangle’ header argument. Org derives the
> file name as being relative to the directory of the Org file’s
> location. Example: ‘:tangle FILENAME’.
>
> 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
> 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 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.
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 suite
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, but I
> > find my approach much less intrusive (particularly the initial bit in the
> > .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 same
> > 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
next prev parent reply other threads:[~2021-07-07 5:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 18:54 [PATCH] Allow tangling to a list of files Jacopo De Simoi
2021-07-06 2:57 ` Vladimir Lomov
2021-07-06 4:43 ` Greg Minshall
2021-07-06 5:09 ` Jacopo De Simoi via General discussions about Org-mode.
2021-07-06 6:11 ` Vladimir Lomov
2021-07-06 15:24 ` Jacopo De Simoi via General discussions about Org-mode.
2021-07-07 3:27 ` Vladimir Lomov
2021-07-07 4:09 ` Tim Cross
2021-07-07 5:01 ` Jacopo De Simoi [this message]
2021-07-07 6:56 ` Greg Minshall
2021-07-07 11:05 ` Jacopo De Simoi
2021-07-09 12:26 ` Vladimir Lomov
2021-07-09 13:39 ` Jacopo De Simoi
2021-07-09 22:47 ` Tim Cross
2021-07-06 7:30 ` Tim Cross
2021-07-07 23:06 ` Jacopo De Simoi via General discussions about Org-mode.
2021-07-07 23:28 ` Tim Cross
2021-07-08 0:01 ` Jacopo De Simoi
2021-07-08 0:41 ` Tom Gillespie
2021-07-08 16:41 ` Trust me I am a Doctor
2021-07-08 17:42 ` Jacopo De Simoi
[not found] <-0ZoEP_lzUvrnWSq9TwiYHNJ0Spa94xjiTOF0TU8np0pYgHEPx-62_dr5xBMd3VUu7frSRXxiAFje99v2jeaJg==@protonmail.internalid>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2202345.ElGaqSPkdT@bl4ckspoons \
--to=wilderjds@protonmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=lomov.vl@yandex.ru \
--cc=minshall@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).