It turned out my previous attempt at sorting didn't quite work, here is an improved version of the hack for anyone else who wants to add sub-priorities to control sorting of todo items:
(defun org-cmp-sub-priority (a b) """Compare the titles of string A and B This function can be used in the org-agenda-cmp-user-defined variable and org-agenda-sorting-strategy to compare the sort order of org entries. It looks for something of the from TODO[<priority>]-<num> where <priority> is one of #A, #B, #C indicating an org prioity and <num> is a sub-priority which org doesn't know about but which controls the sorting order. For example, I have TODO entries like TODO [#A]-01 foo TODO [#A]-02 bar TODO [#A]-03 baz and use this function to make sure they get sorted properly in the todo screen of org-agenda. """ (let* ((aa (car (last (split-string (substring-no-properties a) "TODO .#.")))) (bb (car (last (split-string (substring-no-properties b) "TODO .#.")))) (use-a (string-match "^.?-[0-9]" aa)) (use-b (string-match "^.?-[0-9]" bb)) ) (cond ((and use-a use-b) ;; check if both aa and bb have a priority (cond ((string-lessp aa bb) -1) ;; if so, just compare strings ((string-lessp bb aa) +1) (t nil))) (use-a -1) ;; a has priority but not b (use-b +1) ;; b has priority but not a (t nil)) ;; nobody has priority so don't compare )) (setq org-agenda-cmp-user-defined 'org-cmp-sub-priority) (setq org-agenda-sorting-strategy '((agenda habit-down time-up priority-down category-keep) (todo priority-down user-defined-up) (tags priority-down category-keep) (search category-keep))) On Mon, May 17, 2010 at 7:50 AM, Emin.shopper Martinian.shopper <emin.shop...@gmail.com> wrote: > On Thu, May 13, 2010 at 4:59 PM, Bernt Hansen <be...@norang.ca> wrote: >> "Emin.shopper Martinian.shopper" <emin.shop...@gmail.com> writes: >> >> >> See the variable org-agenda-sorting-strategy. >> >> -Bernt > > > Thanks for the pointer. I put the following in my .emacs file and the > I change my prioritized items to things like TODO [#A]-01 foo, TODO > [#A]-02 bar, etc. and things sort as I wanted. > > > (defun org-cmp-title (a b) > "Compare the titles of string A and B" > (cond ((string-lessp a b) -1) > ((string-lessp b a) +1) > (t nil))) > > (setq org-agenda-cmp-user-defined 'org-cmp-title) > > (setq org-agenda-sorting-strategy > '((agenda habit-down time-up priority-down category-keep) > (todo priority-down user-defined-up category-keep) > (tags priority-down category-keep) > (search category-keep))) > _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode