From: Jeff Mickey <jeff@archlinux.org>
To: Memnon Anon <gegendosenfleisch@googlemail.com>
Cc: emacs-orgmode Org-Mode <emacs-orgmode@gnu.org>
Subject: Re: Sort by Inactive Timestamp
Date: Sat, 8 Dec 2012 20:54:49 -0800 [thread overview]
Message-ID: <CAKr=PyOmsE8SnXd9-=zWGDN=7w2EKW6uh2zy9gN=h-g0i0fkfA@mail.gmail.com> (raw)
In-Reply-To: <874njx1x9d.fsf@mean.albasani.net>
On Fri, Dec 7, 2012 at 11:43 AM, Memnon Anon
<gegendosenfleisch@googlemail.com> 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
next prev parent reply other threads:[~2012-12-09 4:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 22:30 Sort by Inactive Timestamp Jeff Mickey
2012-12-07 0:35 ` Samuel Wales
2012-12-07 0:38 ` Samuel Wales
2012-12-07 19:43 ` Memnon Anon
2012-12-09 4:54 ` Jeff Mickey [this message]
2012-12-09 16:11 ` Memnon Anon
-- strict thread matches above, loose matches on Subject: below --
2012-12-06 22:13 Jeff Mickey
2012-12-07 16:41 ` John Hendy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKr=PyOmsE8SnXd9-=zWGDN=7w2EKW6uh2zy9gN=h-g0i0fkfA@mail.gmail.com' \
--to=jeff@archlinux.org \
--cc=emacs-orgmode@gnu.org \
--cc=gegendosenfleisch@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).