From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Sorting TODOs with time-up Date: Mon, 30 Mar 2009 19:59:29 +0200 Message-ID: <0FCA0437-9513-4C9F-BBFC-6B51A5E8E704@gmail.com> References: Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LoLlo-0001SP-L7 for emacs-orgmode@gnu.org; Mon, 30 Mar 2009 13:59:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LoLll-0001Qf-24 for emacs-orgmode@gnu.org; Mon, 30 Mar 2009 13:59:36 -0400 Received: from [199.232.76.173] (port=39856 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LoLlk-0001Qa-Lg for emacs-orgmode@gnu.org; Mon, 30 Mar 2009 13:59:32 -0400 Received: from mail-ew0-f160.google.com ([209.85.219.160]:62506) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LoLlj-0004B5-W7 for emacs-orgmode@gnu.org; Mon, 30 Mar 2009 13:59:32 -0400 Received: by ewy4 with SMTP id 4so2295710ewy.42 for ; Mon, 30 Mar 2009 10:59:31 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Engster Cc: emacs-orgmode@gnu.org On Mar 30, 2009, at 4:46 PM, David Engster wrote: > Matthew Lundin writes: >> David Engster writes: >>> I guess this should be simple but somehow it's not working for me. I >>> want to generate a todo list which is sorted according to the >>> scheduled >>> date. Consider the following test.org file: > > [...] > >>> This minimal setup >>> >>> (setq org-agenda-files '("~/orgtest/test.org")) >>> (setq org-agenda-sorting-strategy >>> '((agenda time-up priority-down category-keep) >>> (todo time-up priority-down category-keep) >>> (tags priority-down category-keep) >>> (search category-keep))) >>> >>> should sort TODOs according to time, right? But when I do > >> As far as I understand it, time-up sorts only by time of day in the >> agenda view. I.e., it will place items that have been scheduled for a >> particular hour at the top of the agenda. >> >> Here's some info from the docstring: >> >> ,---- >> | time-up Put entries with time-of-day indications >> first, early first >> | time-down Put entries with time-of-day indications >> first, late first >> | >> | Pull out all entries having a specified time of day and sort them, >> | in order to make a time schedule for the current day the first >> thing in the >> | agenda listing for the day. >> `---- > > Thanks for the clarification. This is a bit confusing, since sorting > by > priority works in the todo list, but sorting with date does not. Also, > since I call the function 'org-agenda', it is a bit unexpected that > when > I press 't' afterwards I don't really get an agenda but a TODO list, > which seems to behave differently in some aspects from the normal > agenda > view I get when pressing 'a'. Yes, this is bad terminology, which evolved historically. "org-agenda" is a dispatcher for the different views that we call "agenda views". One of the "agenda views" is the global todo list (on `t'), another one is the "daily/weekly agenda" (on `'a), which is a list of what is due today or this week. I always try to call it explicitly "daily/weekly agenda" to avoid some of that confusion, but I agree, if I'd get a chance to start again I would use better terms. Now these are so engrained in our mailing list culture and into tutorials etc that I do not dare to change them anymore. > >> There is the possibility of using a user-defined function. Perhaps >> you >> could use that to sort by date. >> >> ,---- >> | user-defined-up Sort according to `org-agenda-cmp-user- >> defined', high last. >> | user-defined-down Sort according to `org-agenda-cmp-user- >> defined', high first. >> `---- > > Unfortunately, this does not help, since there is no time > information in > the entries 'a' and 'b' to sort by; it seems the timestamps are simply > not extracted when building TODO lists. Yes can use the text property on a, `org-hd-marker', which is a marker pointing to the original location of the item. You can make your function go back to get this information. For example with (org-entry-get (get-text-property 0 'org-hd-marker a) "SCHEDULED") The most efficient implementation would be to first check if there is a `scheduled-time' or so property on the items. If yes, use it. If not, get the property and store it in a text property. This will be efficient because each item will probably be tested several times during the sorting. The information is not extracted by default because that would take extra parsing time and it is usually not needed. - Carsten