I would like to be able to search for all TODO's with a property of FEATURE_NUM, and that property is inherited in my TODO's.

Here's what I have in my init.el to make that property inheritable:

(setq org-use-property-inheritance
      (list "FEATURE_NUM"))

I then have a TODO tree that looks like thes:

* Task List
  :FEATURE_NUM: 12345
** TODO Go over the API design docs                      :c_coding:

When I search using org-sparse-tree for an element with that property name and value, that TODO is returned.

I then looked in the org-ql docs regarding property searches and saw that I need to use a custom predicate if I want to search for properties using inheritance. I therefore created a query like this:

(org-ql-block '(and
                (property "FEATURE_NUM")
                (> 0 (string-to-number (org-entry-get (point) "FEATURE_NUM" 'inherit)))

I'm trying to evaluate each TODO and see if it has that property name and the value is > 0. However, this query always returns nil.

Can anyone see what I'm missing? According to the docs this seems to be the right way to do things.


Oh duh, I guess I was trying to make things too complicated. This ended up working:

(org-ql-block '(and
                (org-entry-get (point) "FEATURE_NUM" 'inherit))) 

Since I'm using the org-entry-get function I don't need the property predicate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.