From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aLs6LlNtJWCdcgAA0tVLHw (envelope-from ) for ; Thu, 11 Feb 2021 17:45:55 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aKwWKlNtJWDkawAAbx9fmQ (envelope-from ) for ; Thu, 11 Feb 2021 17:45:55 +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 B74DC940274 for ; Thu, 11 Feb 2021 17:45:54 +0000 (UTC) Received: from localhost ([::1]:33008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAG2K-0005RJ-20 for larch@yhetil.org; Thu, 11 Feb 2021 12:45:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAG16-0005OJ-M2 for emacs-orgmode@gnu.org; Thu, 11 Feb 2021 12:44:36 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:38000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAG12-0007Eg-VQ for emacs-orgmode@gnu.org; Thu, 11 Feb 2021 12:44:36 -0500 Received: by mail-wr1-x434.google.com with SMTP id b3so5030059wrj.5 for ; Thu, 11 Feb 2021 09:44:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zzamboni-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GCv0BXoLriKPq8kVPUYc8MQX2syY3xq54Gh7MGCsVd0=; b=T/dmdgybrkCyHVHJ0mInskQFa2ANe1I0/qqVz5jAgSLlGjgQD3TrlSwkeC6WYy2G2Q I8sy519A4gzZLPnftBumeewkb8an5alT1aP31nD9ymur1o8LgxYR1LqFRI1oPYT8sukl EQ/a5f6lcOMVOCM8MdHQaWToMkxWRcHORR6bxDngNLFCNnSwcwYa+k1UTQDGZqk4D7M0 inpRk4pLmAyc0alQgauAGHceMvnXzAwofGn7kM1XqliFe6Jc8uoKYEto4dfiRnwJgT/x owH/KJWfVZOFnwaAxHknUtUNEgKK1runMIYhWo3lABsuR9S+Pm6jwOKpHZheVoSPOKqr GNNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GCv0BXoLriKPq8kVPUYc8MQX2syY3xq54Gh7MGCsVd0=; b=B+usdh6XMd8mKU19+DYSorWurKCWe6zHsbatBZqSpt2Cu6KN4CUWTwqoRuc4ZTsgrD O1GSZKWAx85OchXTLiqgSjPeXnW0cPCwUD0f/j9VPLySKZBCDndgPnhX4DHlfuQ8f0+Q 2PGQ8Ldbazb9e+xdI29lRwsrTiz5sbe8FLKuND7DzlQ/9QizfFsoMmjL3+T1jZTkvom0 NfurqNEO7S2Agv93r0WAGq1yKESIR9wVEU3mRZHUN/F2pJOlKt4THyabUJjZKMPjVRTA 8Z0v58MsjLdFlMpIAhvCBrOWVHqhagAZZiQPUeUbquw9ZZIhRnJlU8gwncNIs6+R4zYS g1Bw== X-Gm-Message-State: AOAM53068KKtopFQC9SesgJIQuzmhm4ZxkAdpIjL8P3QEl9VsWPufv2x jqAszwyUAmM5/Wq8udFtIMK7rxyCbB1zwBvN7jIfIQ== X-Google-Smtp-Source: ABdhPJwHobOU9yewAeLY00dOow1oDLeUhbkTxYqNpYcMG6aNlUDJEHE9dZaM9mYQ3NvQWnUT2rd0E8IdSSQYW2vQGJE= X-Received: by 2002:a5d:618e:: with SMTP id j14mr4786423wru.377.1613065470884; Thu, 11 Feb 2021 09:44:30 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Diego Zamboni Date: Thu, 11 Feb 2021 18:44:19 +0100 Message-ID: Subject: Re: 2 Surprises and 2 Questions Regarding Org Tangle To: Lee Jia Hong Content-Type: multipart/alternative; boundary="0000000000006454b105bb1312e2" Received-SPF: none client-ip=2a00:1450:4864:20::434; envelope-from=diego@zzamboni.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: "emacs-orgmode@gnu.org" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.56 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=zzamboni-org.20150623.gappssmtp.com header.s=20150623 header.b="T/dmdgyb"; dmarc=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-Migadu-Queue-Id: B74DC940274 X-Spam-Score: -2.56 X-Migadu-Scanner: scn0.migadu.com X-TUID: ug4nNBD4MGEE --0000000000006454b105bb1312e2 Content-Type: text/plain; charset="UTF-8" Jia, #2 is known (maybe documented? Not sure) behavior: using :noweb-ref accumulates multiple blocks with the same name, whereas #+NAME uses only the first one. I think #+NAME's are supposed to be unique within a document. I don't know about #1, the output from your P1 example seems surprising to me as well. --Diego On Thu, Feb 11, 2021 at 5:13 PM Lee Jia Hong wrote: > (First time posting to a mailing list, please correct me if I did > something wrong.) > > TLDR: > Surprise 1: Different Noweb reference placing styles produces different > tangled results. > Question 1: Is it a bug? > > Surprise 2: Source block naming with #+NAME: and :noweb-ref produce > different tangled results. > Question 2: Is it a bug? > > ------------------------------------------------------------------------------------ > > Hi, > > I stumble upon this article (https://www.hhyu.org/posts/literate_config/), > and there are two things that standout: > 1. the way author places the Noweb reference, i.e.: > (setq org-capture-templates > '( > <> > ) > ) > 2. the way he uses :noweb-ref to tangle multiple code blocks to the same > Noweb reference. > > > > * Surprise 1: Different Noweb Reference Placing Styles Produces Different > Tangled Results > > ------------------------------------------------------------------------------------------------ > The way he places the Noweb reference intrigues me, so I try writing it in > different (placing) styles: > P1: > (setq org-capture-templates '(<>)) > > P2: > (setq org-capture-templates > '(<>)) > > P3: > (setq org-capture-templates > '( > <>)) > > P4: > (setq org-capture-templates > '( > <> > )) > > Tangled results using P3 and P4 styles match my expectations. But the > results of P1 and P2 styles surprise me. > > Expected result for P1: > #+begin_example > (setq org-capture-templates '(("t" "TODO inbox" > entry > (file "~/gtd/capture.org") > "* TODO %? > SCHEDULED: %t") > ("n" "notes inbox" > entry > (file "~/gtd/inbox.org") > "* %T\n%i%?"))) > #+end_example > > Actual result: > #+begin_example > (setq org-capture-templates '(("t" "TODO inbox" > (setq org-capture-templates '( entry > (setq org-capture-templates '( (file "~/gtd/capture.org") > (setq org-capture-templates '( "* TODO %? > (setq org-capture-templates '( SCHEDULED: %t") > (setq org-capture-templates '(("n" "notes inbox" > (setq org-capture-templates '( entry > (setq org-capture-templates '( (file "~/gtd/inbox.org") > (setq org-capture-templates '( "* %T\n%i%?"))) > #+end_example > > Expected result for P2: > #+begin_example > (setq org-capture-templates > '(("t" "TODO inbox" > entry > (file "~/gtd/capture.org") > "* TODO %? > SCHEDULED: %t") > ("n" "notes inbox" > entry > (file "~/gtd/inbox.org") > "* %T\n%i%?"))) > #+end_example > > Actual result: > #+begin_example > (setq org-capture-templates > '(("t" "TODO inbox" > '( entry > '( (file "~/gtd/capture.org") > '( "* TODO %? > '( SCHEDULED: %t") > '(("n" "notes inbox" > '( entry > '( (file "~/gtd/inbox.org") > '( "* %T\n%i%?"))) > #+end_example > > Question 1: Is this a bug? If not, how can I make sure that style P1 and > P2 produce the expected results? > > > > * Surprise 2: Source Block Naming with #+NAME: and :noweb-ref Produce > Different Tangled Results > > ----------------------------------------------------------------------------------------------------------- > I have been naming my source blocks with #+NAME, and it's my first time > realising that it's possible to tangle multiple source blocks to a single > Noweb reference. To try it out, I write the reference holder like this: > #+begin_src emacs-lisp > (setq org-capture-templates > '( > <>)) > #+end_src > (Note: Use placing style P3 because styles P1 and P2 doesn't work as > expected, see Surprise 1 above) > > Then follow by source blocks named with #+NAME: > #+NAME: ORG_CAPTURE > #+begin_src emacs-lisp > ("t" "TODO inbox" > entry > (file "~/gtd/capture.org") > "* TODO %? > SCHEDULED: %t") > #+end_src > > #+NAME: ORG_CAPTURE > #+begin_src emacs-lisp > ("n" "notes inbox" > entry > (file "~/gtd/inbox.org") > "* %T\n%i%?") > #+end_src > > Expected result: > #+begin_example > (setq org-capture-templates > '( > ("t" "TODO inbox" > entry > (file "~/gtd/capture.org") > "* TODO %? > SCHEDULED: %t") > ("n" "notes inbox" > entry > (file "~/gtd/inbox.org") > "* %T\n%i%?"))) > #+end_example > > Actual result: > #+begin_example > (setq org-capture-templates > '( > ("t" "TODO inbox" > entry > (file "~/gtd/capture.org") > "* TODO %? > SCHEDULED: %t"))) > #+end_example > (Not working as expected, because it only tangle the first source block > with the given name.) > > However, with :noweb-ref <>, it's working as expected: > #+begin_src emacs-lisp :noweb-ref ORG_CAPTURE > ("t" "TODO inbox" > entry > (file "~/gtd/capture.org") > "* TODO %? > SCHEDULED: %t") > #+end_src > > #+begin_src emacs-lisp :noweb-ref ORG_CAPTURE > ("n" "notes inbox" > entry > (file "~/gtd/inbox.org") > "* %T\n%i%?") > #+end_src > > Result: > #+begin_example > (setq org-capture-templates > '( > ("t" "TODO inbox" > entry > (file "~/gtd/capture.org") > "* TODO %? > SCHEDULED: %t") > ("n" "notes inbox" > entry > (file "~/gtd/inbox.org") > "* %T\n%i%?"))) > #+end_example > > Question 2: Is this a bug? If not, how can I produce the expected result > using #+NAME naming? > (I prefer #+NAME over :noweb-ref because that line is more obvious and > easily to be read since it can be fontified to stand out in different > colour for a given Emacs theme.) > > > > * What I Have Done > -------------------- > Read the Org-mode info Section 15.10 "Noweb Reference Syntax". > > > > * My Environments > -------------------- > OS: Ubuntu 18.04.3 LTS x86_64 > Emacs version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ > Version 3.22.30, cairo version 1.15.10) of 2020-10-14 > Org-mode version: Org mode version 9.3 (release_9.3 @ > /usr/local/share/emacs/28.0.50/lisp/org/) > > You can reproduce my "experiment" with the attached Org file. Tangle the > attached file and you will get eight files (eight because there are eight > different combinations of placing style * naming style). Then tangle each > of the eight file to see the result for yourself. > > > > ---- > Regards, > Jia Hong > --0000000000006454b105bb1312e2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Jia,

#2 is known (maybe documented? Not= sure) behavior: using :noweb-ref accumulates multiple blocks with the same= name, whereas #+NAME uses only the first one. I think #+NAME's are sup= posed to be unique within a document.

I don't = know about #1, the output from your P1 example seems surprising=C2=A0to me = as well.

--Diego



On Thu, Feb 11, 2021 at 5:13 PM Lee Jia Hong <jia_hong@live.com.my> wrote:
(First time posting to a mailing list, = please correct me if I did something wrong.)

TLDR:
Surprise 1: Different Noweb reference placing styles produces different tan= gled results.
Question 1: Is it a bug?

Surprise 2: Source block naming with #+NAME: and :noweb-ref produce differe= nt tangled results.
Question 2: Is it a bug?
---------------------------------------------------------------------------= ---------

Hi,

I stumble upon this article (https://www.hhyu.org/posts/l= iterate_config/), and there are two things that standout:
1. the way author places the Noweb reference, i.e.:
=C2=A0 (setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <<ORG_CAPTURE>>
=C2=A0 =C2=A0 =C2=A0 =C2=A0)
=C2=A0 )
2. the way he uses :noweb-ref to tangle multiple code blocks to the same No= web reference.



* Surprise 1: Different Noweb Reference Placing Styles Produces Different T= angled Results
---------------------------------------------------------------------------= ---------------------
The way he places the Noweb reference intrigues me, so I try writing it in = different (placing) styles:
P1:
(setq org-capture-templates '(<<ORG_CAPTURE>>))

P2:
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(<<ORG_CAPTURE>>))

P3:
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <<ORG_CAPTURE>>))

P4:
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <<ORG_CAPTURE>>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ))

Tangled results using P3 and P4 styles match my expectations. But the resul= ts of P1 and P2 styles surprise me.

Expected result for P1:
#+begin_example
(setq org-capture-templates '(("t" "TODO inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/capture.org<= /a>")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* TODO %?
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0SCHEDULED: %t") =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ("n" "notes inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/
inbox.org&= quot;)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* %T\n%i%?")= ))
#+end_example

Actual result:
#+begin_example
(setq org-capture-templates '(("t" "TODO inbox"
(setq org-capture-templates '( entry
(setq org-capture-templates '( (file "~/gtd/capture.org")
(setq org-capture-templates '( "* TODO %?
(setq org-capture-templates '(=C2=A0 =C2=A0 SCHEDULED: %t")
(setq org-capture-templates '(("n" "notes inbox" (setq org-capture-templates '( entry
(setq org-capture-templates '( (file "~/gtd/inbox.org")
(setq org-capture-templates '( "* %T\n%i%?")))
#+end_example

Expected result for P2:
#+begin_example
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(("t" "TODO inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/capture.org")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* TODO %?
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SCHEDULED: %t")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ("n" "notes inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/inbox.org")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* %T\n%i%?")))
#+end_example

Actual result:
#+begin_example
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(("t" "TODO inbox"
=C2=A0 =C2=A0 =C2=A0 '( entry
=C2=A0 =C2=A0 =C2=A0 '( (file "~/gtd/capture.org")
=C2=A0 =C2=A0 =C2=A0 '( "* TODO %?
=C2=A0 =C2=A0 =C2=A0 '(=C2=A0 =C2=A0 SCHEDULED: %t")
=C2=A0 =C2=A0 =C2=A0 '(("n" "notes inbox"
=C2=A0 =C2=A0 =C2=A0 '( entry
=C2=A0 =C2=A0 =C2=A0 '( (file "~/gtd/inbox.org")
=C2=A0 =C2=A0 =C2=A0 '( "* %T\n%i%?")))
#+end_example

Question 1: Is this a bug? If not, how can I make sure that style P1 and P2= produce the expected results?



* Surprise 2: Source Block Naming with #+NAME: and :noweb-ref Produce Diffe= rent Tangled Results
---------------------------------------------------------------------------= --------------------------------
I have been naming my source blocks with #+NAME, and it's my first time= realising that it's possible to tangle multiple source blocks to a sin= gle Noweb reference. To try it out, I write the reference holder like this:=
#+begin_src emacs-lisp
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <<ORG_CAPTURE>>))
#+end_src
(Note: Use placing style P3 because styles P1 and P2 doesn't work as ex= pected, see Surprise 1 above)

Then follow by source blocks named with #+NAME:
#+NAME: ORG_CAPTURE
#+begin_src emacs-lisp
("t" "TODO inbox"
=C2=A0entry
=C2=A0(file "~/gtd/capture.org")
=C2=A0"* TODO %?
=C2=A0 =C2=A0 SCHEDULED: %t")
#+end_src

#+NAME: ORG_CAPTURE
#+begin_src emacs-lisp
("n" "notes inbox"
=C2=A0entry
=C2=A0(file "~/gtd/inbox.org")
=C2=A0"* %T\n%i%?")
#+end_src

Expected result:
#+begin_example
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ("t" "TODO inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/capture.org")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* TODO %?
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SCHEDULED: %t")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ("n" "notes inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/inbox.org")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* %T\n%i%?")))
#+end_example

Actual result:
#+begin_example
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ("t" "TODO inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/capture.org")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* TODO %?
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SCHEDULED: %t")))
#+end_example
(Not working as expected, because it only tangle the first source block wit= h the given name.)

However, with :noweb-ref <<REFERENCE>>, it's working as exp= ected:
#+begin_src emacs-lisp :noweb-ref ORG_CAPTURE
("t" "TODO inbox"
=C2=A0entry
=C2=A0(file "~/gtd/capture.org")
=C2=A0"* TODO %?
=C2=A0 =C2=A0 SCHEDULED: %t")
#+end_src

#+begin_src emacs-lisp :noweb-ref ORG_CAPTURE
("n" "notes inbox"
=C2=A0entry
=C2=A0(file "~/gtd/inbox.org")
=C2=A0"* %T\n%i%?")
#+end_src

Result:
#+begin_example
(setq org-capture-templates
=C2=A0 =C2=A0 =C2=A0 '(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ("t" "TODO inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/capture.org")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* TODO %?
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SCHEDULED: %t")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ("n" "notes inbox"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file "~/gtd/inbox.org")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"* %T\n%i%?")))
#+end_example

Question 2: Is this a bug? If not, how can I produce the expected result us= ing #+NAME naming?
(I prefer #+NAME over :noweb-ref because that line is more obvious and easi= ly to be read since it can be fontified to stand out in different colour fo= r a given Emacs theme.)



* What I Have Done
--------------------
Read the Org-mode info Section 15.10 "Noweb Reference Syntax".


* My Environments
--------------------
OS: Ubuntu 18.04.3 LTS x86_64
Emacs version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Versio= n 3.22.30, cairo version 1.15.10) of 2020-10-14
Org-mode version: Org mode version 9.3 (release_9.3 @ /usr/local/share/emac= s/28.0.50/lisp/org/)

You can reproduce my "experiment" with the attached Org file. Tan= gle the attached file and you will get eight files (eight because there are= eight different combinations of placing style * naming style). Then tangle= each of the eight file to see the result for yourself.



----
Regards,
Jia Hong
--0000000000006454b105bb1312e2--