I am trying to build a 'cleanup' agenda view, with a section for all tasks which are done and a review section for tasks in the HOLD or WAITING states. HOLD and WAITING are states I've defined as incomplete in

(setq org-todo-keywords '(
                      (sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
                      (sequence "HABIT(x)" "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING")))

I've tried to add a custom agenda command

("c" "Cleanup" ((todo '("WAITING" "HOLD")

etc, which I based off of the skip format, such as

(org-agenda-skip-function '(org-agenda-skip-entry-if 'todo '("NEXT" "HABIT")))

which works fine. As a view definition though, this doesn't work. What is a good way to get a view of only the specific TODO states I want without manually skipping every other state?


You can use "|" as an OR operator when matching TODO states. An agenda view of

("c" "Cleanup" todo "HOLD|WAITING")

will list all todo entries in the "HOLD" or "WAITING" states. If you also want the more detailed matching of a tags-todo query you can use "/" to separate the todo states from the tag query or test the special "TODO" property with a regular expression

("c" "Cleanup" tags-todo "+sometag-badtag/HOLD|WAITING")
("c" "Cleanup" tags-todo "+sometag-badtag+TODO={HOLD\\|WAITING}")

As far as I know, org-agenda-skip-if is the way to go.

You could combine it with nottodo, which, as you'd guess, is the inverse of todo. That way you don't need to update your custom agenda manually when you alter the keyword sequence.

             'nottodo '("WAITING" "HOLD")))

See the documentation on org-agenda-skip-if for more details on possible arguments.

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.