0

is there a straightforward way to exclude an item starting with

* CANCELLED

from the agenda?

it seems like there is probably an easy way to do this in the docs by setting a variable in init.el but I haven't found it.

thanks

1
3

Make CANCELLED one of your TODO states and make sure that it is one of the DONE states. The agenda does not show DONE states by default. For example, add something like the following to the top of the file:

#+TODO: TODO DELEGATED WAITING | CANCELLED DONE

Press C-c C-c on the above line to make sure Org knows about it (or close the file and reopen it). A heading in a TODO state (those to the left of the vertical bar) is potentially shown in the agenda; if it is in a DONE state (those to the right of the vertical bar), it will not be.

This also gives you the ability to change the TODO state using standard methods (C-c C-t in the file, t in the agenda).

To do the equivalent setup using org-todo-keywords, add something like this to your init file:

(setq org-todo-keywords '("TODO" "DELEGATED" "WAITING" "|" "CANCELLED" "DONE"))

adding a stringified vertical bar at the appropriate place - see TODO keywords as workflow states in the Org mode manual.

There are two variables whose settings might affect the above: org-agenda-skip-scheduled-if-done and org-agenda-skip-deadline-if-done affect some aspects of whether an item is shown in the agenda: if these variables are non-nil, then a scheduled (resp. deadline) item will not be shown in the agenda if it is in a DONE state, but if they are nil, it will be shown but only on the relevant date. I recommend that you set them to non-nil for now and revisit them later if necessary.

You should definitely read the TODO chapter of the Org mode manual.

7
  • thanks that was exactly the type of fix i was looking for. One question, is there an equivalent way to do that in init.el? I'm currently defining TODO states there with (setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "WAITING" "CANCELLED" "DONE"))) Mar 5 '20 at 14:40
  • 1
    Added the info to the answer.
    – NickD
    Mar 5 '20 at 16:51
  • ah thanks, | works across both Mar 5 '20 at 17:07
  • and just a note for answer completion that I rearranged the order to be #+TODO: TODO DELEGATED WAITING | DONE CANCELLED since hopefully I'm finishing more than I'm cancelling. Mar 5 '20 at 17:55
  • 1
    Just saw your last comment - must have missed it when first posted, more than a year ago (!!): thanks for pointing it out! Fixed.
    – NickD
    Jun 11 at 14:23

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.