nobiot / org-transclusion

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

Any hint to exclude a specific keyword? #250

Open rbenit68 opened 3 months ago

rbenit68 commented 3 months ago

The following statement

+transclude: [[file:path/to/file.org]] :exclude-elements "keyword"

excludes all these elements:

(babel-call center-block clock comment comment-block diary-sexp drawer dynamic-block example-block export-block fixed-width footnote-definition headline horizontal-rule inlinetask item keyword latex-environment node-property paragraph plain-list planning property-drawer quote-block section special-block src-block table table-row verse-block)

I think it should be an implementation to exclude specific elements or keywords.

Thanks.

nobiot commented 3 months ago

Please refer to this part of the manual:

‘:exclude-elements’ This property lets you add elements to exclude per transclusion on top of the variable org-transclusion-exclude-elements defines. You cannot remove the ones defined by it; thus, it is intended that you use the customizable variable as your global default and fine-tune it by the property per transclusion.

rbenit68 commented 3 months ago

Thank you.

The issue is that keyword, in excluding context, means

  '("ARCHIVE:" "AUTHOR:" "BIBLIOGRAPHY:" "BIND:" "CATEGORY:" "CITE_EXPORT:"
    "COLUMNS:" "CREATOR:" "DATE:" "DESCRIPTION:" "DRAWERS:" "EMAIL:"
    "EXCLUDE_TAGS:" "FILETAGS:" "INCLUDE:" "INDEX:" "KEYWORDS:" "LANGUAGE:"
    "MACRO:" "OPTIONS:" "PROPERTY:" "PRINT_BIBLIOGRAPHY" "PRIORITIES:"
    "SELECT_TAGS:" "SEQ_TODO:" "SETUPFILE:" "STARTUP:" "TAGS:" "TITLE:" "TODO:"
    "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:" "EXPORT_FILE_NAME:"))

everything at once.

So, the question is: how can I exclude title: but not date:, for example?.

nobiot commented 3 months ago

This is not implemented in Org-transclusion. I don’t have a use case for it. What is yours?

As you ask for a “hint”, you can look at lines around here. You could look to override the function org-transclusion-content-filter-org-exclude-elements with your own implementation.

If you want to specify which keyword to be excluded per transclusion, you would also need to devise a way to pass those to be excluded as a value. There is a mechanism to let you do this but I am on vacation without my computer with me. It’s a little hard to give you more specific guidance on my phone…

rbenit68 commented 3 months ago

Thank you, Nobiot

This is not implemented in Org-transclusion. I don’t have a use case for it. What is yours?

I have to share transcluded sources, and in ocassions, my collegues do not want/need too many keywords like title, date, todo, ...

I will try with org-transclusion-content-filter-org-exclude-elements as you mention.