summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-02-20 10:45:59 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-02-20 10:45:59 +0100
commitde51e1aef6c5eab97df6aabe549fbfef5028797e (patch)
tree2039e7694f18df35feb0ab00bbeb2dc24cf528d4
parent1616e084486aae06e24de35f6fc32056b7fb539f (diff)
downloadorg-mode-de51e1aef6c5eab97df6aabe549fbfef5028797e.tar.gz
org-habit: Extend tracking to done notes
* lisp/org-habit.el (org-habit-parse-todo): Also find timestamps when `org-log-done' is `note'. Reported-by: Andrew Francis Swann <swann@math.au.dk>
-rw-r--r--lisp/org-habit.el22
1 files changed, 19 insertions, 3 deletions
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 6013756..f5565ee 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -200,11 +200,27 @@ This list represents a \"habit\" for the rest of this module."
(count 0))
(unless reversed (goto-char end))
(while (and (< count maxdays)
- (funcall search (format "- State \"%s\".*\\[\\([^]]+\\)\\]"
- (regexp-opt org-done-keywords))
+ (funcall search
+ (concat
+ (format "- State \"%s\".*\\[\\([^]]+\\)\\]"
+ (regexp-opt org-done-keywords))
+ "\\|"
+ (org-replace-escapes
+ (regexp-quote
+ (cdr (assq 'done org-log-note-headings)))
+ `(("%d" . ,org-ts-regexp-inactive)
+ ("%D" . ,org-ts-regexp)
+ ("%s" . "\"\\S-+\"")
+ ("%S" . "\"\\S-+\"")
+ ("%t" . ,org-ts-regexp-inactive)
+ ("%T" . ,org-ts-regexp)
+ ("%u" . ".*?")
+ ("%U" . ".*?"))))
limit t))
(push (time-to-days
- (org-time-string-to-time (match-string-no-properties 1)))
+ (org-time-string-to-time
+ (or (org-match-string-no-properties 1)
+ (org-match-string-no-properties 2))))
closed-dates)
(setq count (1+ count))))
(list scheduled sr-days deadline dr-days closed-dates))))