From: Memnon Anon <gegendosenfleisch@googlemail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Sort by Inactive Timestamp
Date: Fri, 7 Dec 2012 19:43:14 +0000 (UTC) [thread overview]
Message-ID: <874njx1x9d.fsf@mean.albasani.net> (raw)
In-Reply-To: CAKr=PyOSH9mWBu-5Tgai67ALVQ8ySY3X9eR_LvRCYgyU2vJUDw@mail.gmail.com
Jeff Mickey <jeff@archlinux.org> writes:
> However.. my current issue: I'd like to sort my todo's by when I
> entered them. So in my capture template I put an inactive timestamp at
> the bottom, so my headlines look something like:
>
> --8<---------------cut here---------------start------------->8---
> * Todo
> ** TODO call mom
> - Ask about christmas
> - Talk about Dad
> - See if she bought a dog
>
> [2012-12-05 Wed 16:36]
> ** TODO Yet another thing
> [2012-12-05 Wed 16:37]
> --8<---------------cut here---------------end--------------->8---
>
> I'd love to have a way to bring up the agenda and have it sorted by
> this ctime I'm manually inserting. Do people have suggestions on the
> best way to support this?
>
> Maybe add a property to my TODOs that is this creation time?
> Has anyone else done something similar to this using
> org-agenda-cmp-user-defined?
Hmmm.
If your 'creation' timestamp is the only inactive timestamp, you won't
need a special property; org-entry-get should give you the right one.
I am not good at this, but what about something like:
--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?
If you use :logbook:, entries within will 'override' your inactive
timestamp at the end of the entry. A special CREATED property would be
useful in this case.
> ... is this the wrong place to ask this question?
Definitely not :).
Memnon
next prev parent reply other threads:[~2012-12-07 19:43 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 [this message]
2012-12-09 4:54 ` Jeff Mickey
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874njx1x9d.fsf@mean.albasani.net \
--to=gegendosenfleisch@googlemail.com \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.