Feat/transient
WIP. Creating this PR to make the work visible.
I'm adding this comment in the context of https://github.com/nobiot/org-transclusion/issues/271. (Thanks for letting me try this dev branch!)
When transcluding an ID link with a dedicated target/search (i.e., [[id:<id>::<target>][<desc>]]), the logic in the following line doesn't work as intended:
https://github.com/nobiot/org-transclusion/blob/feat/transient/org-transclusion.el#L974-L978
when the target is in the section before the first heading (in which case the entire document will be transcluded). I'm not exactly sure the best way to detect whether the transcluded content is non-heading element, but the minimal check along the line of the following seems necessary:
(if (and (org-before-first-heading-p)
(not (looking-at-p "\\(#\\+name:\\|<<\\)")))
(org-transclusion-content-org-filtered
nil plist)
(org-transclusion-content-org-filtered
'only-element plist))
I am just reporting a bug in case this helps when you have time getting back to this branch. Otherwise, the feature branch has been very useful to me, and will continue use and test.
Thank you again for all the work.
@okomestudio Thank you for this. I think I understand the issue. Let me try a couple ideas…
Also thank you for trying the dev branch. I feel assured that it is in a good shape.
@nobiot I have been testing this branch. I noticed that id:<id>::<target> linking doesn't work for the same-file targets. Here's a simple example:
* 08:49 Example of learning human languages via anki and youtube :german:language:journals:2025_09_25:
:PROPERTIES:
:ID: 0c59c5a8-ffb4-40e3-b107-8d7893c2ce4d
:CREATED: [2025-09-25 Thu 08:49]
:END:
The [[https://cjauvin.github.io/posts/learning-persian/][blog post]] is short and simple. However, showcases an effective
method of using youtube and spaced repetition with langauage learning.
The gist of it is that <<gist>>
* 08:53 Showcasing in-file targeting with org-transclusion
:PROPERTIES:
:ID: d697a00d-62b9-4d49-8196-b1ebadfdccda
:CREATED: [2025-09-25 Thu 08:53]
:END:
See this one:
#+transclude: [[id:0c59c5a8-ffb4-40e3-b107-8d7893c2ce4d::gist]]
or this one:
#+transclude: [[id:ccf3c642-fbef-4485-a21b-e83784c3303f::test]]
hitting <f12> (ie, org-transclusion-add) on the first #+transclude: statement works erroneously, while the second #+transclude: statement works correctly. The former one targets the id that's on the same file (this is a org-roam-daily file) while the latter targets the id that's on the previous day's org-roam-daily file.
While the second transclusion works fine, the real problem is that the first transclusion wrongly inserts the <<gist>> up to the target id and gives me something like this which is totally false:
Observe that the transcluded content is inserted right under the source content, which is a real headscratcher.
@k4r4b3y Thank you for testing and reporting this. Really appreciated. Transcluding to the same file (source and target are the same file) is something I don’t do, so it’s tricky for me and I am sure I’m blindsided. Together with what @okomestudio has reported, it looks like I really need to change the logic for the “pasting to the target” part — it seems “finding the source” is working as intended…
@nobiot I updated my org-transclusion to
:branch "feat/transient"
:rev "304ff1b1b9bca9184f174c1badad3c5ef0b0aa0e"
and the problem I described above seems to have been fixed. Thanks for working on it.
@k4r4b3y , thank you for quickly testing the latest changes. I feel we are getting closer to merging this feature branch to main. Hopefully soon :)
closer to merging this feature branch to main. Hopefully soon :)
perfect. Apart from this issue, have you seen the https://github.com/gggion/org-transclusion-blocks
I really like:
This package uses block headers:
Before (org-transclusion):
#+transclude: [[file:org-transclusion-blocks.el]] :src elisp :lines 869-949
After (org-transclusion-blocks):
#+HEADER: :transclude [[file:org-transclusion-blocks.el]]
#+HEADER: :transclude-keywords ":lines 869-949"
#+begin_src elisp
#+end_src
view. I find disappearing #+transclusion keyword after I insert transclusion contents confusing in my org documents, and this org-transclusion-blocks looks good in that regard.