mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-15 17:00:45 +00:00
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.
This commit is contained in:
parent
a6c8fac4f9
commit
b44e3d05ee
@ -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.
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user