emacs-orgmode
[Top][All Lists]
Advanced

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

RE: [Orgmode] Behavior Change/Bug: Agenda sorting of deadline itemsv > 4


From: Eric J Haywiser
Subject: RE: [Orgmode] Behavior Change/Bug: Agenda sorting of deadline itemsv > 4.73
Date: Fri, 1 Feb 2008 11:57:14 -0500 (EST)

Hm, the 4.67c behaviour seems a bit more sensible as it incorporates the
number of days that a deadline is delayed into the priority calculation.
Have a look at the function org-agenda-get-deadlines where the priority
of a deadline is calculated. Specifically the following code:

:       (setq s (match-string 1)
:             pos (1- (match-beginning 1))
:             d2 (org-time-string-to-absolute (match-string 1) d1)
:             diff (- d2 d1)
:             wdays (org-get-wdays s)
:             dfrac (/ (* 1.0 (- wdays diff)) wdays)
:             upcomingp (and todayp (> diff 0)))

and

:                 'priority (+ (if upcomingp (floor (* dfrac 10.)) 100)
:                              (org-get-priority txt))

You might be able to tweak this to get the desired behaviour.

Hope that helps
Christian

Thank you.  That pointer was very helpful.

Without understanding all the details of the priority mechanism, I have this tweak which may introduce other issues.

It maps deadlines in range [-deadline-warning-days -> +deadline-warning-days]
to a priority [2*d-w-d -> 0].  The other priorities coming from
org-get-priority are shifted 10x relative to 2*d-w-d regardless of d-w-d's value. This makes priorites coming from o-g-p have more weight than those calculated within o-a-g-d. I think this may have been the original idea with the (* 1000 and (+ 100 but I'm not really sure.

diff org-5.19a.el org.el
14979d14978
<
14984,14985c14983,14984
<       (* 1000 (- org-lowest-priority org-default-priority))
<       (* 1000 (- org-lowest-priority
---
(* (expt 10 (+ (floor (log10 (* 2 org-deadline-warning-days))) 1)) (-
org-lowest-priority org-default-priority)\
)
(* (expt 10 (+ (floor (log10 (* 2 org-deadline-warning-days))) 1)) (-
org-lowest-priority
21165c21164,21167
<             upcomingp (and todayp (> diff 0)))
---
            partialpriority (+ (- 0 diff) wdays)
            upcomingp (and todayp (> diff 0))
            pastp (<= diff 0)
            )
21204,21205c21206
<                 'priority (+ (if upcomingp (floor (* dfrac 10.)) 100)
<                              (org-get-priority txt))
---
                'priority (+ partialpriority (org-get-priority txt))





reply via email to

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