0

Projects with multiple subprojects are tagged with PROJ, e.g.

** PROJ Master Project
*** PROJ Subproject 1
**** Task 1a
*** PROJ Subproject 2
**** Task 2a

Currently, I have a custom agenda view that will simply display all items with a PROJ tag:

("p" "all projects" todo "PROJ")
  1. How do I modify it so that only master projects (which are all level 2 headings) are displayed?

  2. How do I modify it so that only subprojects (level 3 or more) are displayed?

1

You can use the LEVEL "property" to match a certain subtree level. The match syntax is described in (info "(org) Matching tags and properties"). LEVEL=2 corresponds to subtrees with 2 stars etc. And to answer your questions:

(setq org-agenda-custom-commands
      '(("p" "master projects" tags-todo "LEVEL=2/PROJ")
        ("u" "subprojects" tags-todo "LEVEL>2/PROJ")))
2
  • Thanks! tags-todo is what I was missing. I had to change it to LEVEL=2, though, to match 2-star headings, so I guess the LEVEL property is 1-based instead of 0-based?
    – wiuah
    Aug 22 '16 at 16:27
  • You're right, updated the answer.
    – mutbuerger
    Aug 22 '16 at 17:01

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.