Update: I debugged this by just running (org-entry-get (point) "header-args" 'inherit)
on the source blocks. Turns out I was too tired and the subtrees I thought were buggy actually weren't children of the noweb tree. There was no bug at all. Sorry.
I am working on an Org-mode document where I want the :header-args: :noweb-ref
property to apply to code blocks under subheadings, but I'm having trouble getting the property to inherit correctly.
I have the following structure in my document:
* Main Heading
:PROPERTIES:
:header-args: :noweb-ref IMPORTS
:END:
** Subheading
#+begin_src jupyter-python :exports both
# Some code here...
#+end_src
The :header-args: :noweb-ref IMPORTS
property applies to code blocks directly under the main heading, but it doesn't seem to apply to code blocks under the subheadings. I want this property to be inherited by all subheadings and their code blocks without having to redefine it at each level.
I tried adding header-args
to org-use-property-inheritance
using this in my Emacs configuration:
(add-to-list 'org-use-property-inheritance "header-args")
But this doesn't seem to work, as the header-args
property seemingly is still not inherited by the subheadings. (How do I check this for sure? I just tried running some noweb blocks manually and the code in the subheadings did not execute.)
How can I ensure that :header-args: :noweb-ref
is inherited by all subheadings and their code blocks? Is there another way to configure property inheritance in Org-mode for this use case?
I vaguely remember that this used to work correctly before, and I might have changed sth in my config that broke it. But I have no idea what.
Any help would be appreciated!
C-c c-v I
(bound toorg-babel-view-src-block-info
) to check the environment of each code block. FWIW, I get:noweb-ref IMPORTS
on a code block in the main section, as well as in the code block in the subsection. If that is not the case with you, start withemacs -Q
to make sure that you get the expected results in that case and, assuming that you do, bisect your init file to find what broke it - see emacs.stackexchange.com/questions/28429/…C-c C-v I
gives you the expected result but you still don't get what you expect when tangling, exporting or evaluating, then you are probably doing something wrong and we'd need to see more details of what you are doing.(org-entry-get (point) "header-args" 'inherit)
on the source blocks. Turns out I was too tired and the subtrees I thought were buggy actually weren't children of the noweb tree. There was no bug at all. Sorry.