-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(properties): add option org_use_property_inheritance
#880
feat(properties): add option org_use_property_inheritance
#880
Conversation
Yes, but I forgot to handle situations where we need all properties with
Since we already have inheritance with tags, there are two methods on headline class, Let's do the same thing, and update accordingly:
That should cover all the cases. |
90e1c80
to
c05873b
Compare
This seems reasonable! I've made the changes you suggested and added tests for both I've also added two TODO comments about some behavior that puzzled me somewhat. Let me know what you think about the annotated line and I can either remove them or fix it in a drive-by commit. |
org_use_property_inheritance
org_use_property_inheritance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Let's just address that one TODO that you put, and I think that answers the question for your second TODO on the get_properties method.
lua/orgmode/files/headline.lua
Outdated
@@ -543,6 +577,7 @@ memoize('get_tags') | |||
function Headline:get_tags() | |||
local tags, own_tags_node = self:get_own_tags() | |||
if not config.org_use_tag_inheritance then | |||
-- TODO: Why exclude the headline's own tags here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I think this is a bug. You can remove it.
c05873b
to
e90e710
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Summary
This PR adds the option
org_use_property_inheritance
and allows using property inheritance in searches and via the external API.Related Issues
Extracted from #878
Changes
The code to search for a property recursively was already there, it's just that the default behavior couldn't be configured.
I've changed the behavior of
get_property()
's parametersearch_parents
from two-state (truthy=yes, falsy=no) to tri-state (true
=yes,false
=no,nil
=use config).For the config itself, I've added the option itself and also a method
OrgConfig:use_property_inheritance()
, which evaluates it for a given property name.I've adjusted the special cases where we want to always ignore (or always use) inheritance by grepping the code base for
get_property
and evaluating them one by one. I'm reasonably sure I got all uses, but it doesn't hurt to double check.Checklist
I confirm that I have:
feat: add new feature
,fix: correct bug
,docs: update documentation
).make test
.