emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Reference chains (C refers to B refers to A) in tangle do not


From: Ihor Radchenko
Subject: Re: [BUG] Reference chains (C refers to B refers to A) in tangle do not behave as expected [9.5.5 (release_9.5.5 @ /usr/local/share/emacs/28.2/lisp/org/)]
Date: Tue, 21 May 2024 12:09:22 +0000

"C. M. Sperberg-McQueen" <cmsmcq@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.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]