From 8dbee9185867963b13d064e43a569c31d6fc918c Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 16 Oct 2016 21:02:35 +0200 Subject: [PATCH] org-agenda: Fix effort sorting * lisp/org-agenda.el (org-cmp-effort): Find effort in the appropriate location. The bug was introduced in d978a9e585f94e1e9523243aeb96bb943e77c483. Reported-by: Luke --- lisp/org-agenda.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 4b48a3025..2bc6ef7d4 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -6955,8 +6955,14 @@ The optional argument TYPE tells the agenda type." (defsubst org-cmp-effort (a b) "Compare the effort values of string A and B." (let* ((def (if org-sort-agenda-noeffort-is-high 32767 -1)) - (ea (or (get-text-property (1- (length a)) 'effort-minutes a) def)) - (eb (or (get-text-property (1- (length b)) 'effort-minutes b) def))) + ;; `effort-minutes' property is not directly accessible from + ;; the strings, but is stored as a property in `txt'. + (ea (or (get-text-property + 0 'effort-minutes (get-text-property 0 'txt a)) + def)) + (eb (or (get-text-property + 0 'effort-minutes (get-text-property 0 'txt b)) + def))) (cond ((> ea eb) +1) ((< ea eb) -1)))) -- 2.11.4.GIT