From 80fc5adb58c13297214799cc924c294b771169f9 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Mon, 20 Jan 2014 16:06:19 +0100 Subject: [PATCH] org.el (org-provide-todo-statistics): Allow to set to a list of two lists, for TODO and DONE keywords * org.el (org-provide-todo-statistics): Allow to set to a list of two lists, one with TODO keywords, the other one with DONE keywords. (org-update-parent-todo-statistics): Correctly handle `org-provide-todo-statistics' when it is set as a list of two lists, for TODO and DONE keywords. Thanks to Fletcher Charest for reporting this and requesting this feature. --- lisp/org.el | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 7ed749072..4af10cd9f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -2567,6 +2567,9 @@ ALL-HEADLINES means update todo statistics by including headlines with no TODO keyword as well, counting them as not done. A list of TODO keywords means the same, but skip keywords that are not in this list. +When set to a list of two lists, the first list contains keywords +to consider as TODO keywords, the second list contains keywords +to consider as DONE keywords. When this is set, todo statistics is updated in the parent of the current entry each time a todo state is changed." @@ -2576,6 +2579,9 @@ current entry each time a todo state is changed." (const :tag "Yes, including all entries" all-headlines) (repeat :tag "Yes, for TODOs in this list" (string :tag "TODO keyword")) + (list :tag "Yes, for TODOs and DONEs in these lists" + (repeat (string :tag "TODO keyword")) + (repeat (string :tag "DONE keyword"))) (other :tag "No TODO statistics" nil))) (defcustom org-hierarchical-todo-statistics t @@ -12710,13 +12716,25 @@ statistics everywhere." (match-string 2))) (if (or (eq org-provide-todo-statistics 'all-headlines) (and (listp org-provide-todo-statistics) + (stringp (car org-provide-todo-statistics)) (or (member kwd org-provide-todo-statistics) - (member kwd org-done-keywords)))) + (member kwd org-done-keywords))) + (and (listp org-provide-todo-statistics) + (listp (car org-provide-todo-statistics)) + (or (member kwd (car org-provide-todo-statistics)) + (and (member kwd org-done-keywords) + (member kwd (cadr org-provide-todo-statistics)))))) (setq cnt-all (1+ cnt-all)) (if (eq org-provide-todo-statistics t) (and kwd (setq cnt-all (1+ cnt-all))))) - (and (member kwd org-done-keywords) - (setq cnt-done (1+ cnt-done))) + (when (or (and (listp org-provide-todo-statistics) + (listp (car org-provide-todo-statistics)) + (member kwd org-done-keywords) + (member kwd (cadr org-provide-todo-statistics))) + (and (listp org-provide-todo-statistics) + (stringp (car org-provide-todo-statistics)) + (member kwd org-done-keywords))) + (setq cnt-done (1+ cnt-done))) (outline-next-heading))) (setq new (if is-percent