summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-02-16 13:45:31 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2009-02-16 19:01:52 +0100
commitb44e3d05ee9e676fddd42890f601aaa4ea00b4ba (patch)
tree85407d9705d2cd5d5ced7a7f9d82197d9e650212
parenta6c8fac4f9f790c1dc4add91fbff2b3d5214384d (diff)
downloadorg-mode-b44e3d05ee9e676fddd42890f601aaa4ea00b4ba.tar.gz
Agenda: Fix sorting by TODO state in block agendas
Christopher Suckling reports that todo state sorting doe not work in block agenda. The reason for this that the variable `org-todo-keywords-for-agenda' which is supposed to be a lost of all keywords of all buffers contributing to the agenda, is not correct during the construction of a block agenda. Therefore, this commit instructs the todo state comparison function to refer back to the original buffer for a list of todo keywords.
-rwxr-xr-xlisp/ChangeLog2
-rw-r--r--lisp/org-agenda.el15
2 files changed, 14 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 923d286..6b1b11f 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,8 @@
* org-agenda.el (org-agenda-get-sexps): Add todo state as
property, for sorting.
+ (org-cmp-todo-state): Get the applicable TODO keywords directly
+ from the buffer.
* org.el (org-scan-tags): Add todo state as property, for sorting.
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index e7cf76c..50269c7 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4178,10 +4178,19 @@ HH:MM."
(defsubst org-cmp-todo-state (a b)
"Compare the todo states of strings A and B."
- (let* ((ta (or (get-text-property 1 'todo-state a) ""))
+ (let* ((ma (or (get-text-property 1 'org-marker a)
+ (get-text-property 1 'org-hd-marker a)))
+ (mb (or (get-text-property 1 'org-marker b)
+ (get-text-property 1 'org-hd-marker b)))
+ (fa (and ma (marker-buffer ma)))
+ (fb (and mb (marker-buffer mb)))
+ (todo-kwds
+ (or (and fa (with-current-buffer fa org-todo-keywords-1))
+ (and fb (with-current-buffer fb org-todo-keywords-1))))
+ (ta (or (get-text-property 1 'todo-state a) ""))
(tb (or (get-text-property 1 'todo-state b) ""))
- (la (- (length (member ta org-todo-keywords-for-agenda))))
- (lb (- (length (member tb org-todo-keywords-for-agenda))))
+ (la (- (length (member ta todo-kwds))))
+ (lb (- (length (member tb todo-kwds))))
(donepa (member ta org-done-keywords-for-agenda))
(donepb (member tb org-done-keywords-for-agenda)))
(cond ((and donepa (not donepb)) -1)