emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Sort TODOs in agenda day
@ 2012-01-30 12:30 Jacek Generowicz
  2012-01-31  0:32 ` Bernt Hansen
  0 siblings, 1 reply; 9+ messages in thread
From: Jacek Generowicz @ 2012-01-30 12:30 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

In the standard agenda view for any single day, apponintments appear
in chronolological order before any TODOs which seem to be ordered
accoriding to the order in which they appear in their org files.

How could I get the TODOs to be sorted by something like effort-up
without breaking the chronological sort of the appointments?

Thanks.

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

* Re: Sort TODOs in agenda day
  2012-01-30 12:30 Sort TODOs in agenda day Jacek Generowicz
@ 2012-01-31  0:32 ` Bernt Hansen
  2012-01-31  8:03   ` Jacek Generowicz
  0 siblings, 1 reply; 9+ messages in thread
From: Bernt Hansen @ 2012-01-31  0:32 UTC (permalink / raw)
  To: Jacek Generowicz; +Cc: emacs-orgmode

Jacek Generowicz <jacek.generowicz@cern.ch> writes:

> Hello,
>
> In the standard agenda view for any single day, apponintments appear
> in chronolological order before any TODOs which seem to be ordered
> accoriding to the order in which they appear in their org files.
>
> How could I get the TODOs to be sorted by something like effort-up
> without breaking the chronological sort of the appointments?

Look at the variable org-agenda-sorting-strategy.

Regards,
Bernt

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

* Re: Sort TODOs in agenda day
  2012-01-31  0:32 ` Bernt Hansen
@ 2012-01-31  8:03   ` Jacek Generowicz
  2012-01-31 17:39     ` Bernt Hansen
  0 siblings, 1 reply; 9+ messages in thread
From: Jacek Generowicz @ 2012-01-31  8:03 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

At Mon, 30 Jan 2012 19:32:01 -0500,
Bernt Hansen wrote:
> 
> Jacek Generowicz <jacek.generowicz@cern.ch> writes:
> 
> > Hello,
> >
> > In the standard agenda view for any single day, apponintments appear
> > in chronolological order before any TODOs which seem to be ordered
> > accoriding to the order in which they appear in their org files.
> >
> > How could I get the TODOs to be sorted by something like effort-up
> > without breaking the chronological sort of the appointments?
> 
> Look at the variable org-agenda-sorting-strategy.

Yes, but how do I instruct it to apply one strategy (time-up) to those
items which appear in the time-grid portion of the day's display (the
appointments), and a different one to the other entries (scheduled
TODOs, deadlines)? Specifically, by adding a command to

    org-agenda-custom-commands

which contains something like

    ((agenda ""
      ((org-agenda-sorting-strategy '(effort-up)))))

messes up the time ordering of appointments for that command.

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

* Re: Sort TODOs in agenda day
  2012-01-31  8:03   ` Jacek Generowicz
@ 2012-01-31 17:39     ` Bernt Hansen
  2012-02-01 10:02       ` Jacek Generowicz
  0 siblings, 1 reply; 9+ messages in thread
From: Bernt Hansen @ 2012-01-31 17:39 UTC (permalink / raw)
  To: Jacek Generowicz; +Cc: emacs-orgmode

Jacek Generowicz <jacek.generowicz@cern.ch> writes:

> At Mon, 30 Jan 2012 19:32:01 -0500,
> Bernt Hansen wrote:
>> 
>> Jacek Generowicz <jacek.generowicz@cern.ch> writes:
>> 
>> > Hello,
>> >
>> > In the standard agenda view for any single day, apponintments appear
>> > in chronolological order before any TODOs which seem to be ordered
>> > accoriding to the order in which they appear in their org files.
>> >
>> > How could I get the TODOs to be sorted by something like effort-up
>> > without breaking the chronological sort of the appointments?
>> 
>> Look at the variable org-agenda-sorting-strategy.
>
> Yes, but how do I instruct it to apply one strategy (time-up) to those
> items which appear in the time-grid portion of the day's display (the
> appointments), and a different one to the other entries (scheduled
> TODOs, deadlines)? Specifically, by adding a command to
>
>     org-agenda-custom-commands
>
> which contains something like
>
>     ((agenda ""
>       ((org-agenda-sorting-strategy '(effort-up)))))
>
> messes up the time ordering of appointments for that command.

I have a fairly complicated sorting function which gets the order of
items exactly how I want to see them on the agenda.

The gory details are here:

http://doc.norang.ca/org-mode.html#AgendaViewTweaks

HTH,
Bernt

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

* Re: Sort TODOs in agenda day
  2012-01-31 17:39     ` Bernt Hansen
@ 2012-02-01 10:02       ` Jacek Generowicz
  2012-02-01 12:51         ` Bernt Hansen
  2012-02-02 18:11         ` Samuel Wales
  0 siblings, 2 replies; 9+ messages in thread
From: Jacek Generowicz @ 2012-02-01 10:02 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

At Tue, 31 Jan 2012 12:39:48 -0500,
Bernt Hansen wrote:
> 
> Jacek Generowicz <jacek.generowicz@cern.ch> writes:
>
> > Yes, but how do I instruct it to apply one strategy (time-up) to those
> > items which appear in the time-grid portion of the day's display (the
> > appointments), and a different one to the other entries (scheduled
> > TODOs, deadlines)? Specifically, by adding a command to
> >
> >     org-agenda-custom-commands
> >
> > which contains something like
> >
> >     ((agenda ""
> >       ((org-agenda-sorting-strategy '(effort-up)))))
> >
> > messes up the time ordering of appointments for that command.
> 
> I have a fairly complicated sorting function which gets the order of
> items exactly how I want to see them on the agenda.
> 
> The gory details are here:
> 
> http://doc.norang.ca/org-mode.html#AgendaViewTweaks

I see. Should I infer that org-mode doesn't provide any features for
applying different strategies to different portions of single day's
display in the agenda?

In other words there are no hooks into the standard agenda sorting
strategy, and if you want to modify its behaviour you essentially have
to roll your own from scratch, duplicating much of the original
effort?

> HTH,

Yup.

Thanks.

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

* Re: Sort TODOs in agenda day
  2012-02-01 10:02       ` Jacek Generowicz
@ 2012-02-01 12:51         ` Bernt Hansen
  2012-02-02  9:24           ` Jacek Generowicz
  2012-02-02 18:11         ` Samuel Wales
  1 sibling, 1 reply; 9+ messages in thread
From: Bernt Hansen @ 2012-02-01 12:51 UTC (permalink / raw)
  To: Jacek Generowicz; +Cc: emacs-orgmode

Jacek Generowicz <jacek.generowicz@cern.ch> writes:

> At Tue, 31 Jan 2012 12:39:48 -0500,
> Bernt Hansen wrote:
>> 
>> Jacek Generowicz <jacek.generowicz@cern.ch> writes:
>>
>> > Yes, but how do I instruct it to apply one strategy (time-up) to those
>> > items which appear in the time-grid portion of the day's display (the
>> > appointments), and a different one to the other entries (scheduled
>> > TODOs, deadlines)? Specifically, by adding a command to
>> >
>> >     org-agenda-custom-commands
>> >
>> > which contains something like
>> >
>> >     ((agenda ""
>> >       ((org-agenda-sorting-strategy '(effort-up)))))
>> >
>> > messes up the time ordering of appointments for that command.
>> 
>> I have a fairly complicated sorting function which gets the order of
>> items exactly how I want to see them on the agenda.
>> 
>> The gory details are here:
>> 
>> http://doc.norang.ca/org-mode.html#AgendaViewTweaks
>
> I see. Should I infer that org-mode doesn't provide any features for
> applying different strategies to different portions of single day's
> display in the agenda?
>
> In other words there are no hooks into the standard agenda sorting
> strategy, and if you want to modify its behaviour you essentially have
> to roll your own from scratch, duplicating much of the original
> effort?

Not necessarily, if the standard sorting mechanism with an appropriate
setting for org-agenda-sorting-strategy does what you need then there is
no reason to create a user-defined sorting function (which is what I
did).

You can add BOTH time-up and effort-up to the sorting strategy for the
agenda and time will prevail - for items with a time, and effort will be
the next sorting criteria.

Have you tried this?

;; Sorting order for tasks on the agenda
(setq org-agenda-sorting-strategy
      (quote ((agenda time-up effort-up))))

When I was first experimented with the sorting strategy I used the
customize interface to set it for the current session only and looked at
the result of my agenda with the new setting.

The reason I define and use a user-defined-up sorting function is I want
complete control over where each type of item goes in my agenda.

My setting for the agenda is below:

(setq org-agenda-sorting-strategy
      (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
	      (todo category-up priority-down effort-up)
	      (tags category-up priority-down effort-up)
	      (search category-up))))

so for the agenda daily view habits are at the bottom, and timed items
are at the top, then my user-defined sorting function sorts what is left
for the middle section of the list in the following order:

  - items with no schedule/deadline and timestamped for today
  - deadlines for today
  - late deadlines
  - scheduled items for today
  - late scheduled items
  - and pending deadlines last

Regards,
Bernt

>
>> HTH,
>
> Yup.
>
> Thanks.

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

* Re: Sort TODOs in agenda day
  2012-02-01 12:51         ` Bernt Hansen
@ 2012-02-02  9:24           ` Jacek Generowicz
  2012-02-03  2:06             ` Bernt Hansen
  0 siblings, 1 reply; 9+ messages in thread
From: Jacek Generowicz @ 2012-02-02  9:24 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

At Wed, 1 Feb 2012 07:51:59 -0500,
Bernt Hansen wrote:

> You can add BOTH time-up and effort-up to the sorting strategy for the
> agenda and time will prevail - for items with a time, and effort will be
> the next sorting criteria.

The point I missed is that time-up will only be applied to those items
have a date-stamp for the day in question, so that effort-up will not
be outranked by time-up for the rest of the entries.

> Have you tried this?
> 
> ;; Sorting order for tasks on the agenda
> (setq org-agenda-sorting-strategy
>       (quote ((agenda time-up effort-up))))

I have now: initially I thought that the time-up would leave nothing
for effort-up to work on.

> When I was first experimented with the sorting strategy I used the
> customize interface to set it for the current session only and looked at
> the result of my agenda with the new setting.

Yes, setting configurations for current session only is a huge boon
for trials, but the clunky customize interface for manipulating the
values is a bit annoying compared to Emacs' built in sexpr
manipulation. Swapping the order of two sorting strategy entries, for
example, is very painful compared to C-M-t. Is there some convenient
way of, say, swapping entries in the customize interface?

> (setq org-agenda-sorting-strategy
>       (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
> 	      (todo category-up priority-down effort-up)
> 	      (tags category-up priority-down effort-up)
> 	      (search category-up))))
> 
> so for the agenda daily view habits are at the bottom, and timed items
> are at the top, then my user-defined sorting function sorts what is left
> for the middle section of the list in the following order:

It's still not entirely clear to me how these options work. Take
habit-down, at the beginning. What do the '-down' and '-up' mean? I
infer that they might have one of two meanings: in 'habit-down' the
'-down' seems to mean that habits should be placed at the bottom,
while in 'effort-down' I infer that it means that items with an effort
property should be sorted by decreasing effort, relative to eachother.

There's clearly some confusion in my mind about how these work.

>   - items with no schedule/deadline and timestamped for today
>   - deadlines for today
>   - late deadlines
>   - scheduled items for today
>   - late scheduled items
>   - and pending deadlines last

Incidentally, why did you need to create a macro which captures num-a,
num-b result, for your implementation of bh/agenda-sort?  AFAICT,
functions which return +1,-1 or nil would have been adeqate here. What
have I missed?

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

* Re: Sort TODOs in agenda day
  2012-02-01 10:02       ` Jacek Generowicz
  2012-02-01 12:51         ` Bernt Hansen
@ 2012-02-02 18:11         ` Samuel Wales
  1 sibling, 0 replies; 9+ messages in thread
From: Samuel Wales @ 2012-02-02 18:11 UTC (permalink / raw)
  To: Jacek Generowicz; +Cc: Bernt Hansen, emacs-orgmode

On 2012-02-01, Jacek Generowicz <jacek.generowicz@cern.ch> wrote:
> I see. Should I infer that org-mode doesn't provide any features for
> applying different strategies to different portions of single day's
> display in the agenda?

You check for the section in your user-defined sort function.

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

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

* Re: Sort TODOs in agenda day
  2012-02-02  9:24           ` Jacek Generowicz
@ 2012-02-03  2:06             ` Bernt Hansen
  0 siblings, 0 replies; 9+ messages in thread
From: Bernt Hansen @ 2012-02-03  2:06 UTC (permalink / raw)
  To: Jacek Generowicz; +Cc: emacs-orgmode

Jacek Generowicz <jacek.generowicz@cern.ch> writes:

> At Wed, 1 Feb 2012 07:51:59 -0500,
> Bernt Hansen wrote:
>
>> When I was first experimented with the sorting strategy I used the
>> customize interface to set it for the current session only and looked at
>> the result of my agenda with the new setting.
>
> Yes, setting configurations for current session only is a huge boon
> for trials, but the clunky customize interface for manipulating the
> values is a bit annoying compared to Emacs' built in sexpr
> manipulation. Swapping the order of two sorting strategy entries, for
> example, is very painful compared to C-M-t. Is there some convenient
> way of, say, swapping entries in the customize interface?

I would probably show the current customize setting, paste it to the
scratch buffer and wrap it in a (setq VARIABLE-NAME ...) and then edit
it and C-M-t, then go back to the customize view to tweak other
settings.

The main advantage of customize is it won't break the format.  I used
customize almost exclusively for 2 years when I was working with my
org-mode files and have since moved to setq's only since I'm now
comfortable with the elisp sexp settings.

>
>> (setq org-agenda-sorting-strategy
>>       (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
>> 	      (todo category-up priority-down effort-up)
>> 	      (tags category-up priority-down effort-up)
>> 	      (search category-up))))
>> 
>> so for the agenda daily view habits are at the bottom, and timed items
>> are at the top, then my user-defined sorting function sorts what is left
>> for the middle section of the list in the following order:
>
> It's still not entirely clear to me how these options work. Take
> habit-down, at the beginning. What do the '-down' and '-up' mean? I
> infer that they might have one of two meanings: in 'habit-down' the
> '-down' seems to mean that habits should be placed at the bottom,
> while in 'effort-down' I infer that it means that items with an effort
> property should be sorted by decreasing effort, relative to eachother.
>
> There's clearly some confusion in my mind about how these work.

I came up with my current settings with a bunch of trial and error until
it did what I wanted - then I moved on to something else.  I'm not sure
I understand all of it either :)

>
>>   - items with no schedule/deadline and timestamped for today
>>   - deadlines for today
>>   - late deadlines
>>   - scheduled items for today
>>   - late scheduled items
>>   - and pending deadlines last
>
> Incidentally, why did you need to create a macro which captures num-a,
> num-b result, for your implementation of bh/agenda-sort?  AFAICT,
> functions which return +1,-1 or nil would have been adeqate here. What
> have I missed?

Honestly I can't remember... I was experimenting with macros for the
first time when I wrote this.  The function that is called is passed in
as the first argument but if an elisp function can do the job then the
macro probably isn't required.

What I have works now... so I'm not sure I want to try to fix it :)

Regards,
Bernt

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

end of thread, other threads:[~2012-02-03  2:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-30 12:30 Sort TODOs in agenda day Jacek Generowicz
2012-01-31  0:32 ` Bernt Hansen
2012-01-31  8:03   ` Jacek Generowicz
2012-01-31 17:39     ` Bernt Hansen
2012-02-01 10:02       ` Jacek Generowicz
2012-02-01 12:51         ` Bernt Hansen
2012-02-02  9:24           ` Jacek Generowicz
2012-02-03  2:06             ` Bernt Hansen
2012-02-02 18:11         ` Samuel Wales

Code repositories for project(s) associated with this public 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).