New value 'all-headlines for `org-provide-todo-statistics'.

When org-provide-todo-statistics is set to 'all-headlines, the
statistics are performed against all headlines, including those
with no TODO keyword.

This was requested by David A. Gershman.
This commit is contained in:
Bastien Guerry 2009-07-27 00:35:48 +08:00
parent 402448cb4c
commit 6ebb5f2304
2 changed files with 29 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2009-07-26 Bastien Guerry <bzg@altern.org>
* org.el (org-provide-todo-statistics): Allow new value
'all-headlines for this option, which includes entries with no
TODO keywords in the todo statistics.
(org-update-parent-todo-statistics): Possibly use the new option
from `org-provide-todo-statistics'.
2009-07-25 Bastien Guerry <bzg@altern.org> 2009-07-25 Bastien Guerry <bzg@altern.org>
* org-clock.el (org-dblock-write:clocktable): Add a new option * org-clock.el (org-dblock-write:clocktable): Add a new option

View File

@ -1704,10 +1704,15 @@ by a letter in parenthesis, like TODO(t)."
(defcustom org-provide-todo-statistics t (defcustom org-provide-todo-statistics t
"Non-nil means, update todo statistics after insert and toggle. "Non-nil means, update todo statistics after insert and toggle.
When this is set, todo statistics is updated in the parent of the current ALL-HEADLINES means update todo statistics by including headlines
entry each time a todo state is changed." with no TODO keyword as well. When this is set, todo statistics
is updated in the parent of the current entry each time a todo
state is changed."
:group 'org-todo :group 'org-todo
:type 'boolean) :type '(choice
(const :tag "For TODO entries" t)
(const :tag "By all headlines" 'all-headlines)
(const :tag "No TODO statistics" nil)))
(defcustom org-hierarchical-todo-statistics t (defcustom org-hierarchical-todo-statistics t
"Non-nil means, TODO statistics covers just direct children. "Non-nil means, TODO statistics covers just direct children.
@ -4538,7 +4543,7 @@ between words."
"^\\(\\**\\)\\(\\* \\)\\(.*\xa\\)" "^\\(\\**\\)\\(\\* \\)\\(.*\xa\\)"
"^\\(\\**\\)\\(\\* \\)\\(.*\\)") "^\\(\\**\\)\\(\\* \\)\\(.*\\)")
(1 (org-get-level-face 1)) (1 (org-get-level-face 1))
(2 (org-get-level-face 2)) (2 (org-get-level-face 2))
(3 (org-get-level-face 3))) (3 (org-get-level-face 3)))
;; Table lines ;; Table lines
'("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
@ -6631,7 +6636,7 @@ C-c C-c Set tags / toggle checkbox"
(defun orgstruct++-mode (&optional arg) (defun orgstruct++-mode (&optional arg)
"Toggle `orgstruct-mode', the enhanced version of it. "Toggle `orgstruct-mode', the enhanced version of it.
In addition to setting orgstruct-mode, this also exports all indentation In addition to setting orgstruct-mode, this also exports all indentation
and autofilling variables from org-mode into the buffer. It will also and autofilling variables from org-mode into the buffer. It will also
recognize item context in multiline items. recognize item context in multiline items.
Note that turning off orgstruct-mode will *not* remove the Note that turning off orgstruct-mode will *not* remove the
@ -7381,7 +7386,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(let ((org-completion-use-ido nil)) (let ((org-completion-use-ido nil))
(org-completing-read (org-completing-read
"Link: " "Link: "
(append (append
(mapcar (lambda (x) (list (concat x ":"))) (mapcar (lambda (x) (list (concat x ":")))
all-prefixes) all-prefixes)
(mapcar 'car org-stored-links)) (mapcar 'car org-stored-links))
@ -8743,8 +8748,8 @@ This function can be used in a hook."
;;;; Completion ;;;; Completion
(defconst org-additional-option-like-keywords (defconst org-additional-option-like-keywords
'("BEGIN_HTML" "END_HTML" "HTML:" "ATTR_HTML" '("BEGIN_HTML" "END_HTML" "HTML:" "ATTR_HTML"
"BEGIN_DocBook" "END_DocBook" "DocBook:" "ATTR_DocBook" "BEGIN_DocBook" "END_DocBook" "DocBook:" "ATTR_DocBook"
"BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" "ATTR_LaTeX" "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" "ATTR_LaTeX"
"BEGIN:" "END:" "BEGIN:" "END:"
"ORGTBL" "TBLFM:" "TBLNAME:" "ORGTBL" "TBLFM:" "TBLNAME:"
@ -9403,7 +9408,10 @@ statistics everywhere."
(> (setq l1 (length (match-string 1))) level)) (> (setq l1 (length (match-string 1))) level))
(setq kwd (and (or recursive (= l1 ltoggle)) (setq kwd (and (or recursive (= l1 ltoggle))
(match-string 2))) (match-string 2)))
(and kwd (setq cnt-all (1+ cnt-all))) (if (eq org-provide-todo-statistics 'all-headlines)
(setq cnt-all (1+ cnt-all))
(if org-provide-todo-statistics
(and kwd (setq cnt-all (1+ cnt-all)))))
(and (member kwd org-done-keywords) (and (member kwd org-done-keywords)
(setq cnt-done (1+ cnt-done))) (setq cnt-done (1+ cnt-done)))
(outline-next-heading))) (outline-next-heading)))
@ -12191,7 +12199,7 @@ user."
(when org-read-date-overlay (when org-read-date-overlay
(org-delete-overlay org-read-date-overlay) (org-delete-overlay org-read-date-overlay)
(setq org-read-date-overlay nil))))))) (setq org-read-date-overlay nil)))))))
(t ; Naked prompt only (t ; Naked prompt only
(unwind-protect (unwind-protect
(setq ans (read-string prompt default-input (setq ans (read-string prompt default-input
@ -12199,10 +12207,10 @@ user."
(when org-read-date-overlay (when org-read-date-overlay
(org-delete-overlay org-read-date-overlay) (org-delete-overlay org-read-date-overlay)
(setq org-read-date-overlay nil))))) (setq org-read-date-overlay nil)))))
(setq final (org-read-date-analyze ans def defdecode)) (setq final (org-read-date-analyze ans def defdecode))
(setq org-read-date-final-answer ans) (setq org-read-date-final-answer ans)
(if to-time (if to-time
(apply 'encode-time final) (apply 'encode-time final)
(if (and (boundp 'org-time-was-given) org-time-was-given) (if (and (boundp 'org-time-was-given) org-time-was-given)
@ -15850,7 +15858,7 @@ which make use of the date at the cursor."
(org-set-local 'comment-start-skip "^#+[ \t]*") (org-set-local 'comment-start-skip "^#+[ \t]*")
(org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ ]*$\\|[ \t]*[:|]") (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ ]*$\\|[ \t]*[:|]")
;; The paragraph starter includes hand-formatted lists. ;; The paragraph starter includes hand-formatted lists.
(org-set-local (org-set-local
'paragraph-start 'paragraph-start
(concat (concat
"\f" "\\|" "\f" "\\|"