I have hundreds of TODOs scattered across dozens of org buffers. Each of these TODOs has an associated priority. I would like to generate a master list of all these TODOs, sorted by priority. Is this possible?
1 Answer
The TODO list obtained with C-c a t
(bound to org-todo-list
, assuming that you have bound org-agenda
to C-c a
) finalizes the list by calling org-agenda-finalize-entries
which sorts the list using the criteria specified in the variable org-agenda-sorting-strategy
. You should read its doc string (C-h v org-agenda-sorting-stratey
) carefully. The default value for the global TODO list is (priority-down category-keep)
. The simplest thing to do is to set the todo
part of the variable to just (priority-down)
:
(setf (cadr org-agenda-sorting-strategy) '(todo priority-down))
This assumes that the second entry in the list is the todo
part:
((agenda habit-down time-up priority-down category-keep)
(todo priority-down)
(tags priority-down category-keep)
(search category-keep))
That's the default, but you should check your value carefully just in case, and adjust the setf
accordingly.
Given that you have hundreds of TODO entries and there are only three priorities by default, there will be a lot of entries with the same priority in the list, which you will probably want to sort on additional fields. Reading the doc string for org-agenda-sorting-strategy
and experimenting is the best way to find the right settings for you.