org-sort-tasks icon indicating copy to clipboard operation
org-sort-tasks copied to clipboard

Functions to keep TODO tasks in orgmode sorted and organized.

  • Organize your TODO list You can sort an unsorted TODO list using mergesort with org-sort-tasks. The fn will try to find which task is more important taking into account deadline, scheduled time, priority and then, if everything is equal, finally ask to the user.

When the list is already sorted, you can use fn org-insert-sorted-todo-heading to insert a task in a right position using binary search.

** org-insert-sorted-todo-heading An interactive fn that inserts a TODO heading in the right position in a pre-sorted list. Let the cursor above the root (parent) element.

WARNING: If the list is unsorted, use org-sort-tasks first. ** org-sort-tasks An interactive fn that sorts a list of tasks in the selected region or under the headline on cursor.

There are two main ways of use:

  1. Let the cursor at any position of a root headline and press M-x org-sort-tasks.
  2. Mark a region and use M-x org-sort-tasks.

The user will be prompted to reply a simple question like "Should 'xxx task' BE DONE BEFORE 'yyy task'?". After reply some questions, the fn will open a new buffer and build a sorted list of tasks. It is very useful for who uses GTD method and work with huge unsorted lists of tasks. The number of questions will be in avg O(n log n).

[[./org-sort-tasks.gif]]