emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87seybicy5.fsf@localhost> (raw)
In-Reply-To: <87jzjov2ll.fsf@blackmesatech.com>

"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	other threads:[~2024-05-21 12:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 16:44 [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/)] C. M. Sperberg-McQueen
2024-05-21 12:09 ` Ihor Radchenko [this message]
2024-05-21 13:55   ` C. M. Sperberg-McQueen
2024-05-21 14:16     ` Ihor Radchenko

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=87seybicy5.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=cmsmcq@blackmesatech.com \
    --cc=emacs-orgmode@gnu.org \
    /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).