At Sat, 03 Mar 2012 23:31:47 -0500, Bernt Hansen wrote: > >> (defun bh/agenda-sort-by-heading-date (a b) > >> "Sorting strategy for agenda items. > >> Late deadlines first, then scheduled, then non-late deadlines" > > Oops... this description is all wrong - since I gutted my existing > sorting function to try this... I'll let you fix that :)
:) I wondered about that. There are non-timestamped TODO items in my org files, so I needed to hack a little further. The version below is working beautifully. Thanks for all the help! I doubt I would have figured this out very quickly. James (defun bh/agenda-sort-by-heading-date (a b) "Sorting strategy for agenda items. Timestamped entries first (ascending order), then non-timestamped" ;(message "Heading a: <%s>" a) ;(message "Heading b: <%s>" b) (let* ((date-regexp "\\(\\<[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\\) ") date-a date-b) (if (string-match date-regexp a) (setq date-a (match-string 1 a)) (setq date-a "ZZZZZZ") ; clunko workaround to push dateless entries last ) (if (string-match date-regexp b) (setq date-b (match-string 1 b)) (setq date-b "ZZZZZZ") ) (cond ((string< date-a date-b) -1) ((string< date-b date-a) +1) ;((t nil)) ))) -- James Harkins /// dewdrop world jamshar...@dewdrop-world.net http://www.dewdrop-world.net "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman blog: http://www.dewdrop-world.net/words audio clips: http://www.dewdrop-world.net/audio more audio: http://soundcloud.com/dewdrop_world/tracks