emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
@ 2013-09-12 12:55 Sebastien Vauban
  2013-10-21 21:07 ` Sebastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2013-09-12 12:55 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

The following agenda view is supposed to display the tasks by ascending
_DEADLINE timestamp_.

#+begin_src emacs-lisp
  (add-to-list 'org-agenda-custom-commands
               '("B" "Today"
                 tags-todo "DEADLINE<=\"<today>\""
                 ((org-agenda-overriding-header "Today")
                  (org-agenda-sorting-strategy '(deadline-up)))) t)
#+end_src

However, as you can see with the following ECM:

#+begin_src org
* Health
  :PROPERTIES:
  :CATEGORY: Health
  :END:

** TODO 3Do jogging
   DEADLINE: <2013-09-09 Mon>

** TODO 2Check weekend hours at the gym
   DEADLINE: <2013-09-08 Sun>

* Personal
  :PROPERTIES:
  :CATEGORY: Personal
  :END:

** TODO 4Mail package to Susan
   DEADLINE: <2013-09-12 Thu>

* Shopping
  :PROPERTIES:
  :CATEGORY: Shopping
  :END:

** TODO 1Buy dog food
   DEADLINE: <2013-09-07 Sat>
#+end_src

it sorts the list by _category_, instead!

--8<---------------cut here---------------start------------->8---
Today (4)
   Health:     TODO 3Do jogging
   Health:     TODO 2Check weekend hours at the gym
   Personal:   TODO 4Mail package to Susan
   Shopping:   TODO 1Buy dog food
--8<---------------cut here---------------end--------------->8---

The same sorting criteria, applied on an `agenda' view, does work.

#+begin_src emacs-lisp
  (add-to-list 'org-agenda-custom-commands
               '("G" "Agenda deadline-up"
                 agenda ""
                 ((org-agenda-span 'day)
                  (org-agenda-time-grid nil)
                  (org-agenda-sorting-strategy '(deadline-up)))) t)
#+end_src

--8<---------------cut here---------------start------------->8---
Calendar for today
2013-09-12 Thu ________________________________________________
 5 d ago      TODO 1Buy dog food
 4 d ago      TODO 2Check weekend hours at the gym
 3 d ago      TODO 3Do jogging
 Deadline     TODO 4Mail package to Susan
--8<---------------cut here---------------end--------------->8---

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
  2013-09-12 12:55 [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo' Sebastien Vauban
@ 2013-10-21 21:07 ` Sebastien Vauban
  2013-11-06 13:30   ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2013-10-21 21:07 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

"Sebastien Vauban" wrote:
> The following agenda view is supposed to display the tasks by ascending
> _DEADLINE timestamp_.
>
> #+begin_src emacs-lisp
>   (add-to-list 'org-agenda-custom-commands
>                '("B" "Today"
>                  tags-todo "DEADLINE<=\"<today>\""
>                  ((org-agenda-overriding-header "Today")
>                   (org-agenda-sorting-strategy '(deadline-up)))) t)
> #+end_src
>
> However, as you can see with the following ECM:
>
> #+begin_src org
> * Health
>   :PROPERTIES:
>   :CATEGORY: Health
>   :END:
>
> ** TODO 3Do jogging
>    DEADLINE: <2013-09-09 Mon>
>
> ** TODO 2Check weekend hours at the gym
>    DEADLINE: <2013-09-08 Sun>
>
> * Personal
>   :PROPERTIES:
>   :CATEGORY: Personal
>   :END:
>
> ** TODO 4Mail package to Susan
>    DEADLINE: <2013-09-12 Thu>
>
> * Shopping
>   :PROPERTIES:
>   :CATEGORY: Shopping
>   :END:
>
> ** TODO 1Buy dog food
>    DEADLINE: <2013-09-07 Sat>
> #+end_src
>
> it sorts the list by _category_, instead!
>
> Today (4)
>    Health:     TODO 3Do jogging
>    Health:     TODO 2Check weekend hours at the gym
>    Personal:   TODO 4Mail package to Susan
>    Shopping:   TODO 1Buy dog food
>
> The same sorting criteria, applied on an `agenda' view, does work.
>
> #+begin_src emacs-lisp
>   (add-to-list 'org-agenda-custom-commands
>                '("G" "Agenda deadline-up"
>                  agenda ""
>                  ((org-agenda-span 'day)
>                   (org-agenda-time-grid nil)
>                   (org-agenda-sorting-strategy '(deadline-up)))) t)
> #+end_src
> Calendar for today
> 2013-09-12 Thu ________________________________________________
>  5 d ago      TODO 1Buy dog food
>  4 d ago      TODO 2Check weekend hours at the gym
>  3 d ago      TODO 3Do jogging
>  Deadline     TODO 4Mail package to Susan

Anybody having a hint on this?

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
  2013-10-21 21:07 ` Sebastien Vauban
@ 2013-11-06 13:30   ` Bastien
  2014-02-13  9:58     ` Sebastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2013-11-06 13:30 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

"Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:

>> Calendar for today
>> 2013-09-12 Thu ________________________________________________
>>  5 d ago      TODO 1Buy dog food
>>  4 d ago      TODO 2Check weekend hours at the gym
>>  3 d ago      TODO 3Do jogging
>>  Deadline     TODO 4Mail package to Susan
>
> Anybody having a hint on this?

That's because deadline-up/down is active in "agenda" agenda views,
not in tags view -- and "DEADLINE<=\"<today>\"" ... is a tag search,
not an "agenda" agenda view.

I know the answer cannot be 100% satisfying, but sorting by date
in this case would require to add a text property to each agenda
entry, and would be certainly too time consuming (not tested.)

-- 
 Bastien

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

* Re: [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
  2013-11-06 13:30   ` Bastien
@ 2014-02-13  9:58     ` Sebastien Vauban
  2014-03-21  7:55       ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2014-02-13  9:58 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Bastien,

Bastien wrote:
> Sebastien Vauban writes:
>
>>> Calendar for today
>>> 2013-09-12 Thu ________________________________________________
>>>  5 d ago      TODO 1Buy dog food
>>>  4 d ago      TODO 2Check weekend hours at the gym
>>>  3 d ago      TODO 3Do jogging
>>>  Deadline     TODO 4Mail package to Susan
>>
>> Anybody having a hint on this?
>
> That's because deadline-up/down is active in "agenda" agenda views,
> not in tags view -- and "DEADLINE<=\"<today>\"" ... is a tag search,
> not an "agenda" agenda view.
>
> I know the answer cannot be 100% satisfying, but sorting by date
> in this case would require to add a text property to each agenda
> entry, and would be certainly too time consuming (not tested.)

Though, not speaking of fundamental differences (such as: you have to
write specific code to skip different types of entries), going the
"agenda" agenda view approach is not (yet) satisfying.

Let's consider the following ecm.org file:

--8<---------------cut here---------------start------------->8---
* List of tasks

** TODO Pay electricity bill (before 18/02)
   DEADLINE: <2014-02-18 Tue -3d>

... but first wait for my pay of the first half of the month (15/02).

** TODO Renew newspaper subscription
   DEADLINE: <2014-02-19 Wed>

** TODO Subscribe to new gym club
   DEADLINE: <2014-03-01 Sat>

My goal is to begin in March.

** TODO Make dentist appointment
   DEADLINE: <2014-04-01 Tue -60d>

Call the dentist much time in advance, because she's got a very long waiting
list.
--8<---------------cut here---------------end--------------->8---

The 26-line "agenda" agenda view:

--8<---------------cut here---------------start------------->8---
    (add-to-list 'org-agenda-custom-commands
                 `("x" "Future tasks (by due date) -- AGENDA VIEW"
                   ((agenda ""
                            ((org-agenda-overriding-header "This week")
                             (org-agenda-skip-function
                              '(my-skip-entry-unless-deadline-in-n-days-or-more 1))
                             (org-deadline-warning-days 7)))
                    (agenda ""
                            ((org-agenda-format-date "")
                             (org-agenda-overriding-header "Following 3 weeks")
                             (org-agenda-skip-function
                              '(my-skip-entry-unless-deadline-in-n-days-or-more 7))
                             (org-deadline-warning-days 28))))
                   ((org-agenda-clockreport-mode nil)
                    (org-agenda-format-date "")
                    (org-agenda-span 'day)
                    (org-agenda-sorting-strategy '(deadline-up))
                    (org-agenda-use-time-grid nil))) t)

    (defun my-skip-entry-unless-deadline-in-n-days-or-more (n)
      "Skip entries that have no deadline, or that have a deadline earlier than in N days."
      (let* ((dl (org-entry-get nil "DEADLINE")))
        (if (or (not dl)
                (equal dl "")
                (org-time< dl (+ (org-time-today) (* n 86400))))
            (progn (outline-next-heading) (point)))))
--8<---------------cut here---------------end--------------->8---

displays:

--8<---------------cut here---------------start------------->8---
This week:
 In 6 d       TODO Renew newspaper subscription
 In 47 d      TODO Make dentist appointment

Following 3 weeks:
 In 16 d      TODO Subscribe to new gym club
 In 47 d      TODO Make dentist appointment
--8<---------------cut here---------------end--------------->8---

This is wrong for 2 tasks:

- "Make dentist appointment" (with a -60d "warning" specifier) appears in both
  "this week" and "following 3 weeks" lists, while it shouldn't appear at all,
  as its deadline doesn't fall within the search ranges.

- "Pay electricity bill" (with a -3d "warning" specifier) doesn't appear in
  "this week" list, while it should.

The 8-line "tags" agenda view:

--8<---------------cut here---------------start------------->8---
    (add-to-list 'org-agenda-custom-commands
                 `("x" "Future tasks (by due date) -- TODO-TAGS VIEW"
                   ((tags-todo "DEADLINE>\"<+0d>\"+DEADLINE<=\"<+7d>\""
                               ((org-agenda-overriding-header "This week")))
                    (tags-todo "DEADLINE>\"<+7d>\"+DEADLINE<=\"<+28d>\""
                               ((org-agenda-overriding-header "Following 3 weeks"))))
                   ((org-agenda-skip-function '(org-agenda-skip-entry-if 'notdeadline))
                    (org-agenda-sorting-strategy '(deadline-up)))) t)
--8<---------------cut here---------------end--------------->8---

does output the right tasks:

--8<---------------cut here---------------start------------->8---
This week:
 ecm:         TODO Pay electricity bill (before 18/02)
 ecm:         TODO Renew newspaper subscription

Following 3 weeks:
 ecm:         TODO Subscribe to new gym club
--8<---------------cut here---------------end--------------->8---

Though the "deadline-up" sorting does not work, as demo'ed in the previous post.

Is there a solution (or work around) that would allow to see the right
tasks (based on the deadline date, not on the "warning" specifier),
sorted by due date?  Any hint?

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
  2014-02-13  9:58     ` Sebastien Vauban
@ 2014-03-21  7:55       ` Bastien
       [not found]         ` <87mwgkf0jq.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2014-03-21  7:55 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

"Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:

> Though the "deadline-up" sorting does not work, as demo'ed in the
> previous post.

Can you point at that post again?

Also, the example in your previous email is quite complex.
If something does not work in `org-agenda-sorting-strategy'
can you make the example minimal, with no special config
or skip functions?

I'd like to fix any problem in this area before 8.2.3,
which will go into Emacs 24.4.

Thanks in advance,

-- 
 Bastien

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

* Re: [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
       [not found]         ` <87mwgkf0jq.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
@ 2014-03-31 14:17           ` Sebastien Vauban
  2015-01-05 12:41             ` Nick
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2014-03-31 14:17 UTC (permalink / raw)
  To: Bastien; +Cc: public-emacs-orgmode-mXXj517/zsQ-wOFGN7rlS/M9smdsby/KFg



Hi Bastien,

> Sebastien Vauban writes:
>
>> Though the "deadline-up" sorting does not work, as demo'ed in the
>> previous post.
>
> Can you point at that post again?

Here is the original post about the "deadline-up" sorting:

http://lists.gnu.org/archive/html/emacs-orgmode/2013-09/msg00518.html

> Also, the example in your previous email is quite complex.  If
> something does not work in `org-agenda-sorting-strategy' can you make
> the example minimal, with no special config or skip functions?

Simply eval this minimalistic custom command:

--8<---------------cut here---------------start------------->8---
  (add-to-list 'org-agenda-custom-commands
               '("B" "Today"
                 tags-todo "DEADLINE<=\"<today>\""
                 ((org-agenda-overriding-header "Today")
                  (org-agenda-sorting-strategy '(deadline-up)))) t)
--8<---------------cut here---------------end--------------->8---

and then use `C-c a B' on your own Org agenda files.

If you use the "followup mode", you'll see that entries are sorted by
category, instead of being sorted by deadline date...

> I'd like to fix any problem in this area before 8.2.3,
> which will go into Emacs 24.4.

That'd be pretty cool, indeed.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
  2014-03-31 14:17           ` Sebastien Vauban
@ 2015-01-05 12:41             ` Nick
  0 siblings, 0 replies; 7+ messages in thread
From: Nick @ 2015-01-05 12:41 UTC (permalink / raw)
  To: emacs-orgmode

Dear Seb and Bastien, 

Sebastien Vauban <sva-news@...> writes:

> > I'd like to fix any problem in this area before 8.2.3,
> > which will go into Emacs 24.4.
> 
> That'd be pretty cool, indeed.

Did you get anywhere with this?
Thank you

Nick

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

end of thread, other threads:[~2015-01-05 12:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12 12:55 [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo' Sebastien Vauban
2013-10-21 21:07 ` Sebastien Vauban
2013-11-06 13:30   ` Bastien
2014-02-13  9:58     ` Sebastien Vauban
2014-03-21  7:55       ` Bastien
     [not found]         ` <87mwgkf0jq.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
2014-03-31 14:17           ` Sebastien Vauban
2015-01-05 12:41             ` Nick

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