emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Sorting TODOs with time-up
@ 2009-03-30 12:57 David Engster
  2009-03-30 13:41 ` Matthew Lundin
  0 siblings, 1 reply; 8+ messages in thread
From: David Engster @ 2009-03-30 12:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

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:

** TODO: first SCHEDULED: <2009-04-01 Wed>
** TODO: second SCHEDULED: <2009-04-23 Thu>
** TODO: third SCHEDULED: <2009-04-16 Thu>

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

M-x org-agenda RET t

I get:

Global list of TODO items of type: ALL
Available with `N r': (0)ALL (1)TODO (2)DONE
  test:       TODO: first SCHEDULED: <2009-04-01 Wed>
  test:       TODO: second SCHEDULED: <2009-04-23 Thu>
  test:       TODO: third SCHEDULED: <2009-04-16 Thu>

Same with org-todo-list. Also, doing 'C-u C-x =' on one of the lines shows
that the time-of-day property is nil, so it seems that there's just no
information for sorting according to date. What am I missing? (I'm using
org-mode snapshot from today with latest Emacs 23 pretest).

Thanks for your help.

-David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Sorting TODOs with time-up
  2009-03-30 12:57 Sorting TODOs with time-up David Engster
@ 2009-03-30 13:41 ` Matthew Lundin
  2009-03-30 14:46   ` David Engster
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew Lundin @ 2009-03-30 13:41 UTC (permalink / raw)
  To: emacs-orgmode

David Engster <deng@randomsample.de> 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:
>
> ** TODO: first SCHEDULED: <2009-04-01 Wed>
> ** TODO: second SCHEDULED: <2009-04-23 Thu>
> ** TODO: third SCHEDULED: <2009-04-16 Thu>
>
> 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.
`----

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.
`----

Best,
Matt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Sorting TODOs with time-up
  2009-03-30 13:41 ` Matthew Lundin
@ 2009-03-30 14:46   ` David Engster
  2009-03-30 17:59     ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: David Engster @ 2009-03-30 14:46 UTC (permalink / raw)
  To: emacs-orgmode

Matthew Lundin <mdl@imapmail.org> writes:
> David Engster <deng@randomsample.de> 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'.

> 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.

Thanks for your help,
-David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: Sorting TODOs with time-up
  2009-03-30 14:46   ` David Engster
@ 2009-03-30 17:59     ` Carsten Dominik
  2009-03-30 21:03       ` David Engster
  0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2009-03-30 17:59 UTC (permalink / raw)
  To: David Engster; +Cc: emacs-orgmode


On Mar 30, 2009, at 4:46 PM, David Engster wrote:

> Matthew Lundin <mdl@imapmail.org> writes:
>> David Engster <deng@randomsample.de> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Sorting TODOs with time-up
  2009-03-30 17:59     ` Carsten Dominik
@ 2009-03-30 21:03       ` David Engster
  2009-03-30 21:15         ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: David Engster @ 2009-03-30 21:03 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Mar 30, 2009, at 4:46 PM, David Engster wrote:
>> 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.

Thank you for the explanation. Maybe this situation could be cleared up
a bit in the manual. While browsing through chapter 10, I got the
impression that the different views are just different filters, but that
I'm always dealing with the same agenda mode, where each entry carries
the same information.

Maybe one could explicitly mention which commands and sorting strategies
only apply to the daily/weekly agenda? I'd also say that the doc-string
of org-agenda-sorting-strategy does not make this point clear enough.

> 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")

I will try that. Thank you for your help!

-David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: Sorting TODOs with time-up
  2009-03-30 21:03       ` David Engster
@ 2009-03-30 21:15         ` Carsten Dominik
  2009-03-31 11:53           ` David Engster
  0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2009-03-30 21:15 UTC (permalink / raw)
  To: David Engster; +Cc: emacs-orgmode


On Mar 30, 2009, at 11:03 PM, David Engster wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> On Mar 30, 2009, at 4:46 PM, David Engster wrote:
>>> 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.
>
> Thank you for the explanation. Maybe this situation could be cleared  
> up
> a bit in the manual. While browsing through chapter 10, I got the
> impression that the different views are just different filters, but  
> that
> I'm always dealing with the same agenda mode, where each entry carries
> the same information.

Actually, I think this is so, entries always do carry the same
information in all these views.  remember that, a Matt said,
time-up is time-of-day only.

>
> Maybe one could explicitly mention which commands and sorting  
> strategies
> only apply to the daily/weekly agenda? I'd also say that the doc- 
> string
> of org-agenda-sorting-strategy does not make this point clear enough.

I will see what I can do.

- Carsten

>
>> 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")
>
> I will try that. Thank you for your help!
>
> -David
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Sorting TODOs with time-up
  2009-03-30 21:15         ` Carsten Dominik
@ 2009-03-31 11:53           ` David Engster
  2009-03-31 14:44             ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: David Engster @ 2009-03-31 11:53 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Mar 30, 2009, at 11:03 PM, David Engster wrote:
>> While browsing through chapter 10, I got the impression that the
>> different views are just different filters, but that I'm always
>> dealing with the same agenda mode, where each entry carries the same
>> information.
>
> Actually, I think this is so, entries always do carry the same
> information in all these views.  remember that, a Matt said,
> time-up is time-of-day only.

Yes. What I wanted to say is that when it do "C-u C-x =" on an entry in
the daily/weekly agenda, I see properties like

  date                 (4 1 2009)
  day                  733498
  dotime               [Show]
  extra                "Scheduled: "
  org-day-cnt          3
  time                 "12:00......"
  time-of-day          1200

which are not existent or 'nil' in the TODO list (but can be parsed
through the org-hd-marker information).

The reason I'm dealing with this, aside from sorting, is that I'd like
to extract date information from (custom) agenda views, so that I can
display them in other programs, e.g. in special Gnus groups. I don't
know yet if that really makes sense, but since I'm mostly living in
Gnus, it would probably have advantages for me.

Regards,
David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: Sorting TODOs with time-up
  2009-03-31 11:53           ` David Engster
@ 2009-03-31 14:44             ` Carsten Dominik
  0 siblings, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2009-03-31 14:44 UTC (permalink / raw)
  To: David Engster; +Cc: emacs-orgmode


On Mar 31, 2009, at 1:53 PM, David Engster wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> On Mar 30, 2009, at 11:03 PM, David Engster wrote:
>>> While browsing through chapter 10, I got the impression that the
>>> different views are just different filters, but that I'm always
>>> dealing with the same agenda mode, where each entry carries the same
>>> information.
>>
>> Actually, I think this is so, entries always do carry the same
>> information in all these views.  remember that, a Matt said,
>> time-up is time-of-day only.
>
> Yes. What I wanted to say is that when it do "C-u C-x =" on an entry  
> in
> the daily/weekly agenda, I see properties like
>
>  date                 (4 1 2009)
>  day                  733498
>  dotime               [Show]
>  extra                "Scheduled: "
>  org-day-cnt          3
>  time                 "12:00......"
>  time-of-day          1200
>
> which are not existent or 'nil' in the TODO list (but can be parsed
> through the org-hd-marker information).
>
> The reason I'm dealing with this, aside from sorting, is that I'd like
> to extract date information from (custom) agenda views, so that I can
> display them in other programs, e.g. in special Gnus groups. I don't
> know yet if that really makes sense, but since I'm mostly living in
> Gnus, it would probably have advantages for me.

You might want to take a brute-force approach then, mapping
over entries with `org-map-entries' and getting all the
properties with (org-entry-properties), and then do any
processing/sorting etc yourself.
You might also want to take a look at org-collector.el, by Eric Schulte.

Regards

- Carsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-03-31 14:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-30 12:57 Sorting TODOs with time-up David Engster
2009-03-30 13:41 ` Matthew Lundin
2009-03-30 14:46   ` David Engster
2009-03-30 17:59     ` Carsten Dominik
2009-03-30 21:03       ` David Engster
2009-03-30 21:15         ` Carsten Dominik
2009-03-31 11:53           ` David Engster
2009-03-31 14:44             ` Carsten Dominik

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).