Thank you for the response.  I am sorry to say I do not understand it.

You say that non-expansion of references in the code block Baker is
expected "when it does not have :noweb tangle".

> ... When retrieving the code for Baker block, Org mode goes to that
> block and cleans up its text according to that block's
> expansion. However, for Baker block, when it does not have :noweb
> tangle, the <<...>> in the code are treated literally.

The problem I am reporting is that the <<...>> in the code of Baker are
treated literally even when Baker DOES have :noweb tangle.

Thanks.

Michael Sperberg-McQueen



Ihor Radchenko <yanta...@posteo.net> writes:

> "C. M. Sperberg-McQueen" <cms...@blackmesatech.com> writes:
>
>> Consider the following literate program in org mode:
>>
>> ................ make-abc.org:
>> #+title: Minimal example
>> #+date: 20 May 2024
>>
>> The first letter is A.
>> #+name: Able
>> #+begin_src txt
>> A is for application.
>> #+end_src
>>
>> The second letter is B.  It follows A.
>> #+name: Baker 
>> #+begin_src txt :noweb tangle
>> <<Able>>
>> B is for beta-tester.
>> #+end_src
>>
>> The third letter is C.  We'll stop here.
>> #+name: Charlie
>> #+begin_src txt :tangle abc.txt :noweb tangle
>> <<Baker>>
>> C is for coder.
>> #+end_src
>>
>> Bottom line: two-level inclusions work only if the middle layer (here,
>> /Baker/) has ~:noweb yes~.  Using ~:noweb tangle~ on /Baker/ produces
>> the same results as using ~:noweb no~.
>
> Yes, and it is expected.
>
>> ...
>> In the org-mode manual [1], the meaning of :noweb tangle is described
>> as: "Expansion of noweb syntax references in the body of the code block
>> when tangling. No expansion when evaluating or exporting."  I think that
>> running org-babel-tangle counts as tangling, so I expect the noweb
>> syntax references inside of code block Baker to be expanded.
>
> They are indeed expanded - there is a single noweb reference in Charlie
> block - <<Baker>>. It is expanded to the code contained in the Baker
> block. When retrieving the code for Baker block, Org mode goes to that
> block and cleans up its text according to that block's
> expansion. However, for Baker block, when it does not have :noweb
> tangle, the <<...>> in the code are treated literally.
>
> In other words, each noweb reference is expanded in its own context,
> according to each block's own header arguments.
>
> Not a bug.
> Canceled.


-- 
C. M. Sperberg-McQueen
Black Mesa Technologies LLC
http://blackmesatech.com

Reply via email to