Browse Source

org-habit: Fix 6652baa39db26df8a8ac5dbbe40f3de91bf1a6b1

* lisp/org-habit.el (org-habit-parse-todo): Fix regexp introduced in
  6652baa39db26df8a8ac5dbbe40f3de91bf1a6b1.
Nicolas Goaziou 10 years ago
parent
commit
e4da74c452
1 changed files with 16 additions and 17 deletions
  1. 16 17
      lisp/org-habit.el

+ 16 - 17
lisp/org-habit.el

@@ -199,23 +199,22 @@ This list represents a \"habit\" for the rest of this module."
 	     (limit (if reversed end (point)))
 	     (count 0)
 	     (re (format
-		  "^[ \t]*-[ \t]+\\(?:%s\\)"
-		  (mapconcat
-		   (lambda (type)
-		     (let ((value (cdr (assq type org-log-note-headings))))
-		       (when value
-			 (org-replace-escapes
-			  (regexp-quote value)
-			  `(("%d" . ,org-ts-regexp-inactive)
-			    ("%D" . ,org-ts-regexp)
-			    ("%s" . "\"\\S-+\"")
-			    ("%S" . "\"\\S-+\"")
-			    ("%t" . ,org-ts-regexp-inactive)
-			    ("%T" . ,org-ts-regexp)
-			    ("%u" . ".*?")
-			    ("%U" . ".*?"))))))
-		   '(state done)
-		   "\\|"))))
+		  "^[ \t]*-[ \t]+\\(?:State \"%s\".*%s%s\\)"
+		  (regexp-opt org-done-keywords)
+		  org-ts-regexp-inactive
+		  (let ((value (cdr (assq 'done org-log-note-headings))))
+		    (if (not value) ""
+		      (concat "\\|"
+			      (org-replace-escapes
+			       (regexp-quote value)
+			       `(("%d" . ,org-ts-regexp-inactive)
+				 ("%D" . ,org-ts-regexp)
+				 ("%s" . "\"\\S-+\"")
+				 ("%S" . "\"\\S-+\"")
+				 ("%t" . ,org-ts-regexp-inactive)
+				 ("%T" . ,org-ts-regexp)
+				 ("%u" . ".*?")
+				 ("%U" . ".*?")))))))))
 	(unless reversed (goto-char end))
 	(while (and (< count maxdays) (funcall search re limit t))
 	  (push (time-to-days