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

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 <yantar92@posteo.net> writes:

> "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.


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


  reply	other threads:[~2024-05-21 13:59 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
2024-05-21 13:55   ` C. M. Sperberg-McQueen [this message]
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=87ed9vtgfb.fsf@blackmesatech.com \
    --to=cmsmcq@blackmesatech.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).