nobiot / org-transclusion

Emacs package to enable transclusion with Org Mode
https://nobiot.github.io/org-transclusion/
GNU General Public License v3.0
917 stars 44 forks source link

[Feature Request] Transclude with ‘:lines’ property with link of org-roam #147

Closed Cletip closed 2 years ago

Cletip commented 2 years ago

Hello, I use org-roam a lot, and this feature would simplify things. Example:

works as expected :

+transclude: [[file:20220611181947-page_of_test.org]] :lines 0-5

error : org-transclusion-content-range-of-lines: Args out of range: #<buffer 33daccd7-1fbe-4dd6-aa8b-18303acd11bb>, 1, 2

+transclude: [[id:33daccd7-1fbe-4dd6-aa8b-18303acd11bb][Test page]] :lines 0-5

Thank you in advance for your answers ^^

nobiot commented 2 years ago

I've created a patch that should do what you requested. Would you be able to test the branch named line-org-id by any chance?

This feature will need to behave differently from other Org buffers. Noted in the commit comment like this:

Org-transclusion treats the target buffer like a normal text file, thus other Org-specific filtering properties such as :exclude-elements and :only-contents won't work as they rely on org-elements (that is, the target buffer needs to be treated as an Org buffer not a text buffer).

Judging from your use case, this does not create a limitation for you.

I'd appreciate if you can let me know how you go with the branch, or are unable to test it. Thank you.

Cletip commented 2 years ago

So, I test the branch, and that :

+transclude: [[id:33daccd7-1fbe-4dd6-aa8b-18303acd11bb][Test page]] :lines 0-5

works perfectly ! Thanks you a lot !

I am not sure of what exactly won't work: I think it's this whole section "4.4 Filter Org elements per transclusion" in the manual, right?

I tried with this too :

+transclude: [[id:20220621120442360949::* First name middle name]]

and it doesn't work. But maybe that's normal because I might have misunderstood your commit comment.

nobiot commented 2 years ago

Thank you for confirming that it works. I'll try to see if I can merge the patch with the main branch.

I tried with this too :

+transclude: [[id:20220621120442360949::* First name middle name]]

It's normal that the "::*" for headline does not work because it's not part of Org-ID to begin with. You'd need to add an ID to the headline.