From c3146209ec752d516502b0fab258534436b0908f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 30 Nov 2016 00:16:56 +0100 Subject: [PATCH] org-agenda: Fix priority for deadlines * lisp/org-agenda.el (org-agenda-get-deadlines): Fix priority computation. Reported-by: Matt Lundin --- lisp/org-agenda.el | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index f7af31bed..024773b4a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -6165,16 +6165,13 @@ specification like [h]h:mm." 'level level 'ts-date deadline 'priority - ;; Adjust priority according to the associated - ;; deadline of the item. Past-due deadlines get - ;; increased priority. - (let ((adjust (cond ((< current today) diff) - ((> current today) (- repeat current)) - ;; Since a nil SHOW-ALL prefer - ;; repeated deadlines, set - ;; adjustment accordingly. + ;; Adjust priority to today reminders about deadlines. + ;; Overdue deadlines get the highest priority + ;; increase, then imminent deadlines and eventually + ;; more distant deadlines. + (let ((adjust (cond ((not today?) 0) ((and (not show-all) (= repeat current)) 0) - (t diff)))) + (t (- diff))))) (+ adjust (org-get-priority item))) 'todo-state todo-state 'type (if upcoming? "upcoming-deadline" "deadline")