]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-habit.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / org / org-habit.el
index 54ba26dd349c8686c8cf3a61821d098a60106ca9..8848ac48b73534cc96ef38c518c2a04b6ad9f212 100644 (file)
@@ -1,6 +1,6 @@
 ;;; org-habit.el --- The habit tracking code for Org-mode
 
-;; Copyright (C) 2009-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -180,7 +180,7 @@ This list represents a \"habit\" for the rest of this module."
        (error "Habit %s has no scheduled date" habit-entry))
       (unless scheduled-repeat
        (error
-        "Habit '%s' has no scheduled repeat period or has an incorrect one"
+        "Habit `%s' has no scheduled repeat period or has an incorrect one"
         habit-entry))
       (setq sr-days (org-habit-duration-to-days scheduled-repeat))
       (unless (> sr-days 0)
@@ -200,7 +200,9 @@ 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\".*\\[\\([^]]+\\)\\]"
+                                           (regexp-opt org-done-keywords))
+                            limit t))
          (push (time-to-days
                 (org-time-string-to-time (match-string-no-properties 1)))
                closed-dates)
@@ -349,14 +351,7 @@ current time."
   (let ((inhibit-read-only t) l c
        (buffer-invisibility-spec '(org-link))
        (moment (time-subtract (current-time)
-                              (list 0 (* 3600 org-extend-today-until) 0)))
-       disabled-overlays)
-    ;; Disable filters; this helps with alignment if there are links.
-    (mapc (lambda (ol)
-           (when (overlay-get ol 'invisible)
-             (overlay-put ol 'invisible nil)
-             (setq disabled-overlays (cons ol disabled-overlays))))
-         (overlays-in (point-min) (point-max)))
+                              (list 0 (* 3600 org-extend-today-until) 0))))
     (save-excursion
       (goto-char (if line (point-at-bol) (point-min)))
       (while (not (eobp))
@@ -372,9 +367,7 @@ current time."
              (time-subtract moment (days-to-time org-habit-preceding-days))
              moment
              (time-add moment (days-to-time org-habit-following-days))))))
-       (forward-line)))
-    (mapc (lambda (ol) (overlay-put ol 'invisible t))
-         disabled-overlays)))
+       (forward-line)))))
 
 (defun org-habit-toggle-habits ()
   "Toggle display of habits in an agenda buffer."