Selective Archiving

Some tasks, when complete, still offer helpful contextual information for sibling/parent tasks. I like keeping those around for awhile.
Other tasks, when complete, are no longer of any use.

Therefore I’d like a way to archive some done tasks, but not others.
Any of the following would suffice:
Archive @done tasks which are currently selected.
Archive @done tasks which match the current search.
Archive the current line and it’s child nodes (recursive).

It sounds like something really easy to accomplish. The easiest way to do this would be to make your own shortcut to a tag like @done-keep. All others can be tagged as @done and therefore archived.

Done gives the date. Done-keep doesn’t. At some point I’d want to selectively move some done-keeps to done and archive. Your solution won’t work for me.

My request is to solve a deeper problem, which is: if you have a hierarchical todo, and complete a child and archive it, it loses it’s context. If you complete all and archive, the hierarchy is archived together. For that reason I wanted to avoid archiving hierarchies until the whole thing is done.

I was pushing for the simplest way to manually deal with this.

I should have mention that making the shortcut was to be done in one of the keyboard applications like, textexpander, alfred, keyboard maestro, etc. that easily add the date to you done-keep tag.

If you don’t feel like buying a new app to accomplish just this, you should give HammerSpoon a look. It is free and uses Lua. You could easily do it there too.

About the deeper problem, if you don’t ask, you don’t receive. Explain the feature you want, why you want it, and why you think other people might want it; and it might be implemented if the developer sees the need. Again, that might or not might happen, but this way you can get it done tonight :slight_smile:

Are you thinking of choosing the archive file name and location from a dialog, or perhaps of a date-time based file name scheme, and a fixed archive folder ?

Of course everything in TaskPaper is a hierarchy, so we need to set some limiting context first. How about this for a rule: “Only archive @done tasks when all subtasks and ancestor tasks are also marked @done”. This limits the archive and conditions to “tasks”.

For example in this case the @done item would get archived:

one
  - two @done

But in this case the @done item would not get archived since it has an ancestor task that isn’t also @done:

- one
  - two @done

I don’t think that I would necessarily like to build this into TaskPaper, since the logic is somewhat complicated. But I agree it would be useful once understood, and could make for a nice script.

Here’s a item path that you can use to “I think” select only the items that you want to archive:

//task @done except task not @done/ancestor-or-self::task///*

Please try it out and let know if it works as you want. It should only select tasks where all descendent and all ancestor tasks are also @done. (Plus since it’s displaying in the editor it will also show ancestors for context, but the archive function would only archive the root tasks, not the ancestors other items that it contains.

1 Like

@jessegrosjean I agree the logic can get complex, and that’s the sort of thing to avoid in a general purpose tool like this.

I thought one of my earlier suggestions could be used to satisfy requirements, and still be quite general. Like:
Archive @done items which match the current search.

That could even be a preference:
[ ] When archiving done items, only archive those that match the current search.

In any case, thanks for the item-path. It does appear to do what it claims to.
I’ll have to take a look at the JS scripting API. Thanks.

If you open TaskPaper’s Script Debugger window then Resources > birch.js then search for “archiveDone” you can find the default implementation code as a starting point.

1 Like