[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Agenda TODO sorting by date
From: |
James Harkins |
Subject: |
Re: [O] Agenda TODO sorting by date |
Date: |
Sun, 04 Mar 2012 14:59:52 +0800 |
User-agent: |
Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/23.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
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
address@hidden
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