emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Sort by Inactive Timestamp


From: Jeff Mickey
Subject: Re: [O] Sort by Inactive Timestamp
Date: Sat, 8 Dec 2012 20:54:49 -0800

On Fri, Dec 7, 2012 at 11:43 AM, Memnon Anon
<address@hidden> wrote:
> --8<---------------cut here---------------start------------->8---
> (defun my-agenda-sort-by-inactive-timestamp (a b)
>   "Sort by interactive timestamp. Oldest first, items without any ts at the 
> bottom."
>   (let* ((ma (or (get-text-property 1 'org-marker a)
>                  (get-text-property 1 'org-hd-marker a)))
>          (mb (or (get-text-property 1 'org-marker b)
>                  (get-text-property 1 'org-hd-marker b)))
>          (tsa (org-entry-get ma "TIMESTAMP_IA"))
>          (tsb (org-entry-get mb "TIMESTAMP_IA"))
>          (ta (when tsa (date-to-time tsa)))
>          (tb (when tsb (date-to-time tsb))))
>
>     (cond  ((eq tsa nil) +1)
>            ((eq tsb nil) -1)
>            ((time-less-p ta tb)
>                 -1)
>            ((time-less-p tb ta)
>                +1)
>            (t nil))))
>
> (setq org-agenda-custom-commands
>       '(("x" "Tasks" todo ""
>                ((org-agenda-overriding-header "Tasks sorted by
>                TIMESTAMP_IA")
>                (org-agenda-cmp-user-defined 
> 'my-agenda-sort-by-inactive-timestamp)
>                 (org-agenda-sorting-strategy
>                  '(user-defined-up)))
>                )))
> --8<---------------cut here---------------end--------------->8---
>
> Does that work?

Thank you Memnon! The (get-text-property 1 'org-marker a) is still
voodoo to me, but that worked perfectly.

  //  jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]