Variable: org-agenda-sorting-strategy

org-agenda-sorting-strategy is a customizable variable defined in org-agenda.el.gz.

Value

((agenda habit-down time-up urgency-down category-keep)
 (todo urgency-down category-keep) (tags urgency-down category-keep)
 (search category-keep))

Documentation

Sorting structure for the agenda items of a single day.

This is a list of symbols which will be used in sequence to determine if an entry should be listed before another entry. The following symbols are recognized:

time-up Put entries with time-of-day indications first, early first.
time-down Put entries with time-of-day indications first, late first.
timestamp-up Sort by any timestamp, early first.
timestamp-down Sort by any timestamp, late first.
scheduled-up Sort by scheduled timestamp, early first.
scheduled-down Sort by scheduled timestamp, late first.
deadline-up Sort by deadline timestamp, early first.
deadline-down Sort by deadline timestamp, late first.
ts-up Sort by active timestamp, early first.
ts-down Sort by active timestamp, late first.
tsia-up Sort by inactive timestamp, early first.
tsia-down Sort by inactive timestamp, late first.
category-keep Keep the default order of categories, corresponding to the
sequence in org-agenda-files(var)/org-agenda-files(fun).
category-up Sort alphabetically by category, A-Z.
category-down Sort alphabetically by category, Z-A.
tag-up Sort alphabetically by last tag, A-Z.
tag-down Sort alphabetically by last tag, Z-A.
priority-up Sort numerically by priority, high priority last.
priority-down Sort numerically by priority, high priority first.
urgency-up Sort numerically by urgency, high urgency last.
                   Urgency is calculated based on item's priority,
                   and proximity to scheduled time and deadline. See
                   info node (org)Sorting of agenda items for
                   details.
urgency-down Sort numerically by urgency, high urgency first.
todo-state-up Sort by todo state, tasks that are done last.
todo-state-down Sort by todo state, tasks that are done first.
effort-up Sort numerically by estimated effort, high effort last.
effort-down Sort numerically by estimated effort, high effort first.
user-defined-up Sort according to org-agenda-cmp-user-defined, high last.
user-defined-down Sort according to org-agenda-cmp-user-defined, high first.
habit-up Put entries that are habits first.
habit-down Put entries that are habits last.
alpha-up Sort headlines alphabetically.
alpha-down Sort headlines alphabetically, reversed.

The different possibilities will be tried in sequence, and testing stops if one comparison returns a "not-equal". For example,
  (setq org-agenda-sorting-strategy
        '(time-up category-keep priority-down))
means: Pull out all entries having a specified time of day and sort them, in order to make a time schedule for the current day the first thing in the agenda listing for the day. Of the entries without a time indication, keep the grouped in categories, don't sort the categories, but keep them in the sequence given in org-agenda-files(var)/org-agenda-files(fun). Within each category sort by priority.

Leaving out category-keep would mean that items will be sorted across categories by priority.

Instead of a single list, this can also be a set of list for specific contents, with a context symbol in the car of the list, any of agenda, todo, tags, search for the corresponding agenda views.

Custom commands can bind this variable in the options section.

This variable was added, or its default value changed, in Org version
9.7.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defcustom org-agenda-sorting-strategy
  '((agenda habit-down time-up urgency-down category-keep)
    (todo   urgency-down category-keep)
    (tags   urgency-down category-keep)
    (search category-keep))
  "Sorting structure for the agenda items of a single day.
This is a list of symbols which will be used in sequence to determine
if an entry should be listed before another entry.  The following
symbols are recognized:

time-up            Put entries with time-of-day indications first, early first.
time-down          Put entries with time-of-day indications first, late first.
timestamp-up       Sort by any timestamp, early first.
timestamp-down     Sort by any timestamp, late first.
scheduled-up       Sort by scheduled timestamp, early first.
scheduled-down     Sort by scheduled timestamp, late first.
deadline-up        Sort by deadline timestamp, early first.
deadline-down      Sort by deadline timestamp, late first.
ts-up              Sort by active timestamp, early first.
ts-down            Sort by active timestamp, late first.
tsia-up            Sort by inactive timestamp, early first.
tsia-down          Sort by inactive timestamp, late first.
category-keep      Keep the default order of categories, corresponding to the
		   sequence in `org-agenda-files'.
category-up        Sort alphabetically by category, A-Z.
category-down      Sort alphabetically by category, Z-A.
tag-up             Sort alphabetically by last tag, A-Z.
tag-down           Sort alphabetically by last tag, Z-A.
priority-up        Sort numerically by priority, high priority last.
priority-down      Sort numerically by priority, high priority first.
urgency-up         Sort numerically by urgency, high urgency last.
                   Urgency is calculated based on item's priority,
                   and proximity to scheduled time and deadline.  See
                   info node `(org)Sorting of agenda items' for
                   details.
urgency-down       Sort numerically by urgency, high urgency first.
todo-state-up      Sort by todo state, tasks that are done last.
todo-state-down    Sort by todo state, tasks that are done first.
effort-up          Sort numerically by estimated effort, high effort last.
effort-down        Sort numerically by estimated effort, high effort first.
user-defined-up    Sort according to `org-agenda-cmp-user-defined', high last.
user-defined-down  Sort according to `org-agenda-cmp-user-defined', high first.
habit-up           Put entries that are habits first.
habit-down         Put entries that are habits last.
alpha-up           Sort headlines alphabetically.
alpha-down         Sort headlines alphabetically, reversed.

The different possibilities will be tried in sequence, and testing stops
if one comparison returns a \"not-equal\".  For example,
  (setq org-agenda-sorting-strategy
        \\='(time-up category-keep priority-down))
means: Pull out all entries having a specified time of day and sort them,
in order to make a time schedule for the current day the first thing in the
agenda listing for the day.  Of the entries without a time indication, keep
the grouped in categories, don't sort the categories, but keep them in
the sequence given in `org-agenda-files'.  Within each category sort by
priority.

Leaving out `category-keep' would mean that items will be sorted across
categories by priority.

Instead of a single list, this can also be a set of list for specific
contents, with a context symbol in the car of the list, any of
`agenda', `todo', `tags', `search' for the corresponding agenda views.

Custom commands can bind this variable in the options section."
  :group 'org-agenda-sorting
  :type `(choice
	  (repeat :tag "General" ,org-sorting-choice)
	  (list :tag "Individually"
		(cons (const :tag "Strategy for Weekly/Daily agenda" agenda)
		      (repeat ,org-sorting-choice))
		(cons (const :tag "Strategy for TODO lists" todo)
		      (repeat ,org-sorting-choice))
		(cons (const :tag "Strategy for Tags matches" tags)
		      (repeat ,org-sorting-choice))
		(cons (const :tag "Strategy for search matches" search)
		      (repeat ,org-sorting-choice))))
  :package-version '(Org . "9.7"))