From mboxrd@z Thu Jan 1 00:00:00 1970 From: Memnon Anon Subject: Re: Sort by Inactive Timestamp Date: Fri, 7 Dec 2012 19:43:14 +0000 (UTC) Message-ID: <874njx1x9d.fsf@mean.albasani.net> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Th3pj-0007Wt-2q for emacs-orgmode@gnu.org; Fri, 07 Dec 2012 14:43:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Th3ph-0006hm-Po for emacs-orgmode@gnu.org; Fri, 07 Dec 2012 14:43:39 -0500 Received: from plane.gmane.org ([80.91.229.3]:54469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Th3ph-0006hg-JR for emacs-orgmode@gnu.org; Fri, 07 Dec 2012 14:43:37 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Th3po-0001JR-PE for emacs-orgmode@gnu.org; Fri, 07 Dec 2012 20:43:44 +0100 Received: from e178202080.adsl.alicedsl.de ([85.178.202.80]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Dec 2012 20:43:44 +0100 Received: from gegendosenfleisch by e178202080.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Dec 2012 20:43:44 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Jeff Mickey 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