Option to delete done tasks rather than Archive them


#1

Would it be possible to add a delete function under Item menu with a keyboard shortcut so that items that have been tagged @done can be deleted rather than archived?


#2

Once scripting is in place it will be easy to write a script to do this, but I don’t like it as a built in option. The issue is that it will delete things without you even being aware of it (they might be randomly scatter throughout your outline and not visible on screen).

Archiving things might also surprise you, but at least things are just getting moved, not deleted.


#3

What would be the script to use to delete done tasks?


#4

Here’s the simplest option I think:

  1. Open Script Editor.app
  2. Set language to JavaScript
  3. Paste and run this script.

This script should find all items tagged with @done in your outline and then remove those items (along with any items that they contain).

function TaskPaperContextScript(editor, options) {
  Item.getCommonAncestors(editor.outline.evaluateItemPath("//@done")).forEach(function(each) {
    each.removeFromParent()
  });
}

Application("TaskPaper").documents[0].evaluate({
  script: TaskPaperContextScript.toString()
})