4

I've got an org file that looks like this:

* Project Cats
** Get them
*** TODO Find a tabby
*** DONE Find one that's orange
    CLOSED: [2016-11-08 Tue 15:32]
** Feed them
*** DONE Buy some food
    CLOSED: [2016-11-08 Tue 15:32]
*** TODO Put it in bowls

Is there a command that, with my cursor on the top headline, will archive everything marked as DONE that's a descendant? After running such a command, I'd expect to see this:

* Project Cats
** Get them
*** TODO Find a tabby
** Feed them
*** TODO Put it in bowls
  • The doc-string for org-archive-subtree states the options that are presently available -- M-x describe-function RET org-archive-subtree RET In particular, read about the prefix argument and see if that achieves the desired result. – lawlist Nov 9 '16 at 2:35
  • @lawlist the prefix arguments to org-archive-subtree will examine only the direct children of the headline, and they will archive a child only if all tasks it contains are done. (Or all timestamps are in the past.) I want to examine anything that's a descendant of the headline, and I want to archive individual items marked as done. – DGrady Nov 9 '16 at 16:03
3

I don't know of a single command, but the following sequence accomplishes this:

  1. C-c a to look at the agenda
  2. < < to restrict the agenda to the buffer and then to the current sub-tree
  3. M DONE to show everything matching a TODO keyword (search for DONE items in the current sub-tree)
  4. * to mark everything in the agenda (all DONE items in the current subtree).
  5. B $ to bulk archive everything you marked (i.e. everything)
  • Any insight into why there isn't a standard command to do this? I'm still learning org-mode and this seemed like a natural thing to do. – DGrady Nov 10 '16 at 19:35
  • 2
    @DGrady Just guessing, but probably nobody asked for it. There are so many ways to use org-mode that they can't account for all of them. So instead they provide basic building blocks: agendas, filters, bulk actions. You can put those together into anything you need. – erikstokes Nov 10 '16 at 23:11
0

On my e-macs using iTerm2 and macOS it is not exactly the same sequence to archive all the done tasks (in a whole given doc):

  • C-c a to display the agenda
  • T DONE to match all entries with the keyword DONE
  • * to mark them all
  • B $ to archive

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.