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 ms11 with LMTPS id YJX/BVVToF4DKAAA0tVLHw (envelope-from ) for ; Wed, 22 Apr 2020 14:23:17 +0000 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 wL+yLFpToF6AEAAAB5/wlQ (envelope-from ) for ; Wed, 22 Apr 2020 14:23:22 +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 370AC940043 for ; Wed, 22 Apr 2020 14:23:22 +0000 (UTC) Received: from localhost ([::1]:51674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRGHZ-0007NM-O0 for larch@yhetil.org; Wed, 22 Apr 2020 10:23:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56622) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRGGz-000768-Ol for emacs-orgmode@gnu.org; Wed, 22 Apr 2020 10:22:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRGGy-0000rr-JX for emacs-orgmode@gnu.org; Wed, 22 Apr 2020 10:22:45 -0400 Received: from hiwela.pair.com ([209.68.5.201]:51500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jRGGy-0000px-4i for emacs-orgmode@gnu.org; Wed, 22 Apr 2020 10:22:44 -0400 Received: from hiwela.pair.com (localhost [127.0.0.1]) by hiwela.pair.com (Postfix) with ESMTP id 0851B9804EC; Wed, 22 Apr 2020 10:22:42 -0400 (EDT) Received: from minshall-entroware-apollo.cliq.com (unknown [70.134.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hiwela.pair.com (Postfix) with ESMTPSA id A91718F0849; Wed, 22 Apr 2020 10:22:41 -0400 (EDT) Received: from apollo2.minshall.org (localhost [IPv6:::1]) by minshall-entroware-apollo.cliq.com (Postfix) with ESMTP id EF7DD60D62; Wed, 22 Apr 2020 07:22:40 -0700 (PDT) From: Greg Minshall To: Nicolas Goaziou Subject: Re: babel/noweb concatenation of equally-named code blocks fails? In-reply-to: Your message of "Wed, 22 Apr 2020 12:50:16 +0200." <875zdrokuv.fsf@nicolasgoaziou.fr> X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 26.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1279789.1587565360.1@apollo2.minshall.org> Content-Transfer-Encoding: quoted-printable Date: Wed, 22 Apr 2020 07:22:40 -0700 Message-ID: <1279790.1587565360@apollo2.minshall.org> Received-SPF: softfail client-ip=209.68.5.201; envelope-from=minshall@umich.edu; helo=hiwela.pair.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 10:22:42 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Received-From: 209.68.5.201 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: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -0.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=umich.edu (policy=none); 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-Scan-Result: default: False [-0.01 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.5656240057054]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.22), country: US(-0.01), ip: 209.51.188.17(-0.57)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[209.51.188.17:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; FROM_NEQ_ENVFROM(0.00)[minshall@umich.edu,emacs-orgmode-bounces@gnu.org]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; HAS_LIST_UNSUB(-0.01)[]; RCVD_COUNT_SEVEN(0.00)[8]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[umich.edu : SPF not aligned (relaxed), No valid DKIM,none] X-TUID: mSxHH3163nEc hi, Nicolas, thanks, and sorry, i should have git-pull'd. the new version seems very nice to me. two minor edits i might make to the first paragraph, 1) to make clear that #+name: names only one block, and 2) to (maybe?) simplify the latter part of the same paragraph, while, at the same time, trying to keep a strong mention of the distinction between =3DNAME=3D and =3Dnoweb-ref=3D at the top of the article. additionally, i did some wordsmithing. i've appended a diff, hopefully in a useful format (C-x C-v =3D); i'm not a git, git patch, expert. i wonder if there might a place in this article to mention org-babel-expand-src-block (C-c C-v v)? it is mentioned, tangentially, later in the manual (but i only came across it recently). cheers, Greg ---- diff --git a/doc/org-manual.org b/doc/org-manual.org index 2a2700739..1c4a1f954 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17988,12 +17988,13 @@ using a noweb[fn:145] style syntax: : <> = #+texinfo: @noindent -where {{{var(CODE-BLOCK-ID)}}} refers to either the =3DNAME=3D of -a specific source code block, or a collection of source code blocks +where {{{var(CODE-BLOCK-ID)}}} refers to either the =3DNAME=3D of = +a single source code block, or a collection of one or more source code bl= ocks sharing the same =3Dnoweb-ref=3D header argument (see [[*Using Header -Arguments]]). Org can replace such references with the source code---or -concatenation thereof--- being referenced, or with the results of an -evaluation. +Arguments]]). Org can replace such references with the source code of +the block or blocks being referenced, or, in the case of a single +source code block named with =3DNAME=3D, with the results of an +evaluation of that block. = #+cindex: @samp{noweb}, header argument The =3Dnoweb=3D header argument controls expansion of noweb syntax @@ -18056,9 +18057,9 @@ the second code block is expanded as ,#+END_SRC #+end_example = -You may also concatenate the contents of multiple blocks sharing -a common =3Dnoweb-ref=3D header argument. For simple concatenation, set -its value at the sub-tree or file level. In the example Org file +You may also include the contents of multiple blocks sharing +a common =3Dnoweb-ref=3D header argument, which can be set at the file, +sub-tree, or code-block level. In the example Org file shown next, the body of the source code in each block is extracted for concatenation to a pure code file when tangled. = @@ -18091,19 +18092,19 @@ concatenation to a pure code file when tangled. By default a newline separates each noweb reference concatenation. To use a different separator, edit the =3Dnoweb-sep=3D header argument. = -Eventually, Org can include the results of evaluation of a single code -block rather than its body. To that effect, append parentheses, -possibly including arguments, to the code block name, as shown below. +Alternatively, Org can include the results of evaluation of a single code +block rather than its body. Evaluation occurs when parentheses, +possibly including arguments, are appended to the code block name, as sho= wn below. = : <> = -Note that when using the above approach to a code block's results, the +Note that in this case, a code block name set by =3DNAME=3D keyword is required; the reference set -by =3Dnoweb-ref=3D is not effective in that case. +by =3Dnoweb-ref=3D will not work when evaluation is desired. = Here is an example that demonstrates how the exported content changes when noweb style references are used with parentheses versus without. -With: +Given: = #+begin_example ,#+NAME: some-code