Browse Source

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 <mideniko1234-org@yahoo.co.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/109811>
Nicolas Goaziou 8 years ago
parent
commit
8dbee91858
1 changed files with 8 additions and 2 deletions
  1. 8 2
      lisp/org-agenda.el

+ 8 - 2
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))))