Add a new sort option, which sorts items by todo keyword in the order of the From: James TD Smith todo sequence. This is a somewhat simple implementation which just uses the position of the keyword in org-todo-keywords-1, so if you have multiple sequences containing the same todo keyword you may not get the ordering you expect. --- org.el | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/org.el b/org.el index dee8471..d67024f 100644 --- a/org.el +++ b/org.el @@ -982,7 +982,6 @@ table, obtained by prompting the user." :group 'org-table-settings :type 'string) - (defcustom org-table-number-regexp "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$" "Regular expression for recognizing numbers in table columns. @@ -6993,7 +6992,7 @@ WITH-CASE, the sorting considers case as well." (message (if plain-list-p "Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:" - "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc A/N/T/P/F means reversed:") + "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc keyword [o]rder A/N/T/P/F/O means reversed:") what) (setq sorting-type (read-char-exclusive)) @@ -7084,6 +7083,10 @@ WITH-CASE, the sorting considers case as well." org-default-priority)) ((= dcst ?r) (or (org-entry-get nil property) "")) + ((= dcst ?o) + (if (looking-at org-complex-heading-regexp) + (or (position (match-string 2) org-todo-keywords-1 :test 'string=) + 9999))) ((= dcst ?f) (if getkey-func (progn