From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Mickey Subject: Re: Sort by Inactive Timestamp Date: Sat, 8 Dec 2012 20:54:49 -0800 Message-ID: References: <874njx1x9d.fsf@mean.albasani.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThYvC-0003Qm-4x for emacs-orgmode@gnu.org; Sat, 08 Dec 2012 23:55:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ThYvB-0002HQ-3l for emacs-orgmode@gnu.org; Sat, 08 Dec 2012 23:55:22 -0500 Received: from mail-oa0-f41.google.com ([209.85.219.41]:48682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ThYvA-0002HK-Vo for emacs-orgmode@gnu.org; Sat, 08 Dec 2012 23:55:21 -0500 Received: by mail-oa0-f41.google.com with SMTP id k14so1845220oag.0 for ; Sat, 08 Dec 2012 20:55:19 -0800 (PST) In-Reply-To: <874njx1x9d.fsf@mean.albasani.net> 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: Memnon Anon Cc: emacs-orgmode Org-Mode On Fri, Dec 7, 2012 at 11:43 AM, Memnon Anon 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