is it possible to show only direct subheadings (children) of a subtree, that have any todo state?

I tried the function org-show-todo-tree which shows a list of all subheadings with a todo state no matter how deep they are nested.

And I tried the function org-show-children, which displays all the children, but also those with a DONE keyword.

But if I runt both functions in sequence one overrides the other. This means I either get only todos or only direct children, not only direct children that are todos.

1 Answer 1


Assuming you are talking about searching in a file, not in the agenda, try this function at the top of the subtree you want to search:

(defun my-sparse-subtree-todo-search ()
  (let ((level (org-current-level)))
    (org-match-sparse-tree  t (format "+LEVEL=%d" (1+ level)))))

Doing M-x my-sparse-subtree-todo-search RET should find all the TODO entries one level down in the current subtree. Very (ahem!) sparsely tested.

  • This is a big step towards the solution! Only my-sparse-subtree-todo-search expands headings with todos, while org-show-childrenneatly folds everything but the heading. This would be the desired result of this focussing operation. Btw: If you consider sharing your config, I would be very interested :-) Jun 16, 2020 at 20:19
  • 1
    Additional to what Nick wrote, I am using configuration which is doc.norang.ca/org-mode.html also stuck-project part shows what you want. Jun 22, 2020 at 20:44

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.