emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'


From: Sebastien Vauban
Subject: Re: [O] [BUG] `org-agenda-sorting-strategy' does not work in `tags-todo'
Date: Thu, 13 Feb 2014 10:58:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]