1

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
  :PROPERTIES:
  :FEATURE_NUM: 12345
  :END:
** 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
                (todo)
                (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.

1 Answer 1

1

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

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

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

1
  • You can accept your own answer (assuming that it answered your question :-) ).
    – NickD
    Commented Oct 26, 2021 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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