Take care of all DONE keywords, not just the last one.

* lisp/org-habit.el

  This fixed a hard-coded TODO keyword
  in the org-habit code. Updated to apply to all DONE keywords, as per
  Aaron Ecay

  TINYCHANGE

---
 lisp/org-habit.el |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index eba9037..63dd27f 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -200,9 +200,11 @@ This list represents a \"habit\" for the rest of this 
module."
             (count 0))
        (unless reversed (goto-char end))
        (while (and (< count maxdays)
-                   (funcall search "- State \"DONE\".*\\[\\([^]]+\\)\\]" limit 
t))
+                   (funcall search (format "- State \"%s\".*\\[\\([^]]+\\)\\]" 
+                                           (concat "\\(" (mapconcat 
'regexp-quote org-done-keywords "\\|") "\\)"))
+                                           limit t))
          (push (time-to-days
-                (org-time-string-to-time (match-string-no-properties 1)))
+                (org-time-string-to-time (match-string-no-properties 2)))
                closed-dates)
          (setq count (1+ count))))
       (list scheduled sr-days deadline dr-days closed-dates))))
-- 
1.7.9.5

>From 29ab93933d5e14847a010e699f79e29aada1efcc Mon Sep 17 00:00:00 2001
From: Theodore Wiles <theodore.wi...@gmail.com>
Date: Mon, 16 Dec 2013 09:47:01 -0500
Subject: [PATCH] Fix a hard-coded TODO keyword

This fixed a hard-coded TODO keyword
in the org-habit code. Updated to apply to all DONE keywords, as per
Aaron Ecay

TINYCHANGE
---
 lisp/org-habit.el |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index eba9037..63dd27f 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -200,9 +200,11 @@ This list represents a \"habit\" for the rest of this module."
 	     (count 0))
 	(unless reversed (goto-char end))
 	(while (and (< count maxdays)
-		    (funcall search "- State \"DONE\".*\\[\\([^]]+\\)\\]" limit t))
+		    (funcall search (format "- State \"%s\".*\\[\\([^]]+\\)\\]" 
+					    (concat "\\(" (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)"))
+					    limit t))
 	  (push (time-to-days
-		 (org-time-string-to-time (match-string-no-properties 1)))
+		 (org-time-string-to-time (match-string-no-properties 2)))
 		closed-dates)
 	  (setq count (1+ count))))
       (list scheduled sr-days deadline dr-days closed-dates))))
-- 
1.7.9.5

Reply via email to