1

I want to make an org-agenda-custom-command that searches for all top-level trees that don't have a sub-tree with a "NEXT" tag. I'm trying to set up a search that I can do at the beginning of the week to make sure that all projects have their next step defined.

I looked into Special Agenda Views which seems close to what I need, but I couldn't figure out a way to use it to search an entry's sub-tree to determine if an entry should be skipped or not.

Any pointers or suggestions that could get me closer to a solution?

Thanks, Matt

0

You can use the special stuck projects agenda view for this (by default C-c a #). It's controlled by a special variable org-stuck-projects. According to the manual:

How to identify stuck projects. This is a list of four items:

  1. A tags/todo/property matcher string that is used to identify a project. See the manual for a description of tag and property searches. The entire tree below a headline matched by this is considered one project.

  2. A list of TODO keywords identifying non-stuck projects. If the project subtree contains any headline with one of these todo keywords, the project is considered to be not stuck. If you specify "*" as a keyword, any TODO keyword will mark the project unstuck.

  3. A list of tags identifying non-stuck projects. If the project subtree contains any headline with one of these tags, the project is considered to be not stuck. If you specify "*" as a tag, any tag will mark the project unstuck. Note that this is about the explicit presence of a tag somewhere in the subtree, inherited tags do not count here. If inherited tags make a project not stuck, use "-TAG" in the tags part of the matcher under (1.) above.

  4. An arbitrary regular expression matching non-stuck projects.

For 1. we can use LEVEL=1 to match a top level headline. For 2. any child marked NEXT makes the project not stuck. 3. and 4 we don't need so we'll leave them nil. Thus (setq org-stuck-projects '("LEVEL=1" ("NEXT") nil nil)) will make the stuck project view show all top level headlines that do not have a child marked "NEXT".

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.