* Introduction
  I live in my org agenda view and I schedule all my tasks to the
  day that I want to do them. I also would like to see my
  achievements so I keep the TODOs that are done in the agenda
  view. However I would like them to get out of the way so that I
  can better see the tasks that are still open. That is why for a
  long time I've been wanting to sort the agenda items by todo
  state.
 
* Patch
  I finally looked at the code and realized that this was not very
  hard to do. The following patch (against 5.13i) implements a new
  org-agenda-sorting-strategy that allows you to sort agenda items
  by todo-state.
 
* Notes
  The patch is basically a "works-for-me" implementation. It only
  sorts todo and scheduled items. It should probably do the same
  for deadlines. Maybe even for timestamps?
 
  The doc strings need to be updated.
 
  Carsten at one time talked about implementing this feature by
  using priorities, i.e. factoring the todo-state into the priority
  (which uses the actual priority plus some calculation based on
  how many days the task is overdue). This patch takes a different
  route.
 
  The sorting is done by comparing the todo-state of the items. It
  first orders them by done state, i.e. all done items come after
  (or before) the items that are not done. After that it compares
  the todo-states with a string compare. This should probably use
  some kind of ordering information from the relevant
  org-todo-keywords sequence.
 
* Conclusion
  So the basic question is: Should I clean up this patch to get it
  included? Is the proposed route (of not taking the priorities)
  ok? And finally: How do I sort taking the sequence order into
  consideration?
   
Christian


<<org.diff>>