Tried two levels of transclusion it did not work
Tried if I can transclude on two levels, but unfortunately it did not work. It seems currently only one level of transclusion is allowed. It does not have to be infinitely recursive but having at least a few levels of transclusion could be useful in practice.
For me a two level transclusion could be already a useful step. The two level transclusion should work, from any level you use transclusion.
Example 1:
A.org < transcludes B.org < transcludes C.org, D.org
C and D would be contained in B. B (together with C and D) would be contained in A.
Thus, triggering transclusion system from A.org would collect until C and D.
Example 2:
B.org < transcludes C.org < transcludes E.org, F.org
Same files as above, but now triggering from B, transclusion (two levels far) would contain this time also E and F inside C.
Not sure if easy to achieve, difficult or already available. Thanks for developing and sharing org-transclusion. This is very useful together with "header hiding technique" via :ignore: tags (another package).
Thank you.
You could manually transclude C and D (in your Example 1) into B first, and then transclude B to A, then A should contain all of B, C and D. That's what I have seen so far.
A.org < transcludes B.org < transcludes C.org, D.org
Depth 0 < Depth 1 < Depth 2
I must say, though, this outcome is not by design but by accident -- I could not foresee it. But it seems to work OK. As far as I could see, the problems are:
- Live-sync edit does not work -- it does not break any of the involved buffers but the error message is not really instructive
- Tranclusion of buffers depth 2 and onward is not done automatically from depth 0
- Following from point 2, removing transclusions deeper than 1 from depth 0 does not work; probably, it should not
This is the current state. I don't have good mental capacity to achieve 2 and 3 properly at the moment. But I'm not against the idea.
What is your use case?
This is very useful together with "header hiding technique" via :ignore: tags (another package). Also what is the package?
Regarding the ignore headline technique, I am pasting a decription I found in stackoverflow, to answer your question in an understandable way:
Add the following to your .emacs file:
(require 'ox-extra)
(ox-extras-activate '(ignore-headlines))
Use the ignore tag on headlines you'd like to have ignored (while not ignoring their content).
Back to my writing. I like the above structuring technique while writing "more complex documents" so you do not lose the overview, you can restructure your document and ideas easiert, but the structure is invisible in the background (during export to latex-pdf). Probably great feature for anyone generating pdf documents from org-mode.
Now combine this "skelett-and-flesh" technique how I call it (the structure is the invisible skelett, and the content sentences is its visible flesh) with your transclusion and you have a quite powerful system of generating larger document from previous planning or written content.
I was checking your transclusion, how far it could go, in the longer context and first obvious question coming to my mind was is it working at least 2 or 3 levels recursively. Why? Well, having no strong arguments now as use cases, but why not? Transclusions idea is bringing content from elsewhere to where I am now. Why should this only work over a "single bridge" and no multiple bridges?
How are you using your transclusion system? Only for one level depth?
How are you using your transclusion system? Only for one level depth?
Yes, only one level. I wrote the package to help me write a book on my professional domain (published in 2021). It's nothing related to programming or Emacs; I'm not a programmer by trade :). The analogy I had in mind was index cards. You write down a chunk of ideas or notes on a reference for each card; you arrange them to organise your thoughts. I think it's the physical version of what you call the "skelett-and-flesh" technique. That's what I wanted to have in Emacs to help me write the book.
first obvious question coming to my mind was is it working at least 2 or 3 levels recursively. Why? Well, having no strong arguments now as use cases, but why not? Transclusions idea is bringing content from elsewhere to where I am now. Why should this only work over a "single bridge" and no multiple bridges?
For me, multiple depths of transclusion is difficult to understand, both practically for book-writing and technically for implementing in Elisp.
This does not mean it should not be done. I may well be trapped in the analogy of index cards -- you probably wouldn't want to "transclude" content from another card, which would be just a "Refer to card No 221" rather than the actual content. But a digital index cards like Org-transclusion might open up opportunities for totally different techniques.
I think the real constraint is my technical ability. Once you go beyond depth 1, there is a case of A to B and B to A. In the case of Org-transclusion, A and B are not files; they are elements within a file. To me it's even harder (more tedious) to check these cyclic cases. And it's only one of the additional problems I have discovered (I have tried more than depth 1 in the course of development).
I'd be happy to get more technical advice or PR on this matter. Practically, I don't think I am capable of solving this problem in a practical way that can be implemented into this package.
Also, thank you for answering the question. (ox-extras-activate '(ignore-headlines)) is indeed interesting. I didn't know about the package.
For what it's worth, Org-transclusion could do this already, if I didn't misunderstand your requirement.
‘:only-contents’ This property lets you exclude titles of headlines when you transclude a subtree (headline); you transclude only the contents. When the subtree contains sub-headlines, all the contents will be transcluded.
https://nobiot.github.io/org-transclusion/#Filter-Org-elements-per-transclusion