From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: Re: using dates as property? Date: Mon, 31 Aug 2015 14:49:44 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWWxX-0003gr-5E for emacs-orgmode@gnu.org; Mon, 31 Aug 2015 17:49:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWWxV-00053P-VF for emacs-orgmode@gnu.org; Mon, 31 Aug 2015 17:49:47 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:33693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWWxV-000534-Np for emacs-orgmode@gnu.org; Mon, 31 Aug 2015 17:49:45 -0400 Received: by wicmc4 with SMTP id mc4so13364824wic.0 for ; Mon, 31 Aug 2015 14:49:45 -0700 (PDT) In-Reply-To: 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: John Kitchin Cc: Org Mode hi john, documented for myself only: (defun alpha-org-timestamp-score (&optional sg) "Return unix minutes as a floating point number. ;;;for 0..1 ;;;Beware adding this to a much larger number (around 100); you will ;;;lose resolution. Multiply first by a number with a lot of ;;;zeroes. Then add to a number with a lot of zeroes. Seems to be unix time as 1970 (or a few hours off, possibly depending on time zone) epoch. This is for sorting conversations, which have an inactive timestamp near the beginning of a header, and for all tasks. === There is no way to get Org to return the first ts of any type. /fixme/ request a timestamp-any property. this gets you the first timestamp no matter whether it is active and no matter where it is. This checks closed first. So the bug is if there is a ts in the headline, closed will take precedence if it exists. Still, this approach works OK; think of the time as always being the time of closing for a doneish, else first ts. That is OK. So not making the request now. /Does not yet consider active timestamps/." ;; ;;make sure these work on any other processor or os ;; ;;(/ (org-time-string-to-seconds "1900-12-31 00:00") 60.0) nan ;;(/ (org-time-string-to-seconds "1901-12-31 00:00") 60.0) -35766300.0 ;;(/ (org-time-string-to-seconds "1934-12-31 00:00") 60.0) -18409980.0 ;;(/ (org-time-string-to-seconds "1960-12-31 00:00") 60.0) -4734300.0 ;;(/ (org-time-string-to-seconds "1969-12-31 00:00") 60.0) -1020.0 ;;(/ (org-time-string-to-seconds "1970-01-01 00:00") 60.0) 420.0 ;;(/ (org-time-string-to-seconds "1980-01-01 00:00") 60.0) 5259300.0 ;;(/ (org-time-string-to-seconds "1990-01-01 00:00") 60.0) 10519620.0 ;;(/ (org-time-string-to-seconds "2010-01-01 00:00") 60.0) 21038820.0 ;;(/ (org-time-string-to-seconds "2038-01-01 00:00") 60.0) 35765700.0 ;;(/ (org-time-string-to-seconds "2138-01-01 00:00") 60.0) nan ;;if you do seconds instead of minutes, it changes magnitude ;;seems ok to multiply by 1e7 or so ;;(+ 1.0 (* 10519620.0 1e8)) 1051962000000001.0 :) ;;(+ 1.0 (* 10519620.0 1e9)) 1.051962e+16 :( ;;(= (+ 1.0 (* 10519620.0 1e9)) (* 10519620.0 1e9)) t :( ;;(/ (org-time-string-to-seconds "1990-01-01 00:00") 60.0) 10,519,620.0 (let ((ts (or ;;this fixes either a doc bug or a real bug, not ;;sure which ;; ;;maybe a doc bug. all timestamps are separate? ;;then fixme if there is ever another inactive ;;timestamp type, you have to add it here. ;; ;;if so, likewise fixme you have to add all 3 active ;;timestamp types and any future ones. (alpha-org-entry-get "CLOSED" sg) (alpha-org-entry-get "TIMESTAMP_IA" sg)))) (aif ts (/ (org-time-string-to-seconds it) 60.0) 0.0))) On 8/31/15, Samuel Wales wrote: > i always put inactive timestamps in headlines, and sort both the > outline and agenda using them. for example: > > ***** CONVERSATION [2015-08-31 Mon 14:41] john > ***** CONVERSATION [2015-09-01 Tue 15:02] rms > > or newest first. they are visible and binary-searchable. > works perfectly for me. > -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com Ramsay's disease DOES progress. MANY people have died from it. And ANYBODY can get it. Denmark: free Karina Hansen NOW.