emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [org-habit] Problem when last DONE date is earlier than `org-h


From: Mikael Fornius
Subject: [Orgmode] [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days'
Date: Thu, 22 Oct 2009 12:17:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Thanks for org-habit, it is a very nice feature!

When the last DONE date is earlier than `org-habit-preceding-days' the
graph can not be rendered due to error in org-habit-build-graph.

I have tracked down the problem (calling time-less-p on nil when
done-dates is empty) and the following patch is solving the issue for me
but I am not sure if this is how you intended it.

diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 6ba2097..26de1b0 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -278,10 +278,9 @@ Habits are assigned colors on the following basis:
        (graph (make-string (1+ (- (time-to-days ending)
                                   (time-to-days starting))) ?\ ))
        (index 0))
-    (if done-dates
-       (while (time-less-p (car done-dates) starting)
-         (setq last-done-date (car done-dates)
-               done-dates (cdr done-dates))))
+    (while (and done-dates (time-less-p (car done-dates) starting))
+      (setq last-done-date (car done-dates)
+           done-dates (cdr done-dates)))
     (while (time-less-p day ending)
       (let* ((now-days (time-to-days day))
             (in-the-past-p (< now-days current-days))
-- 
Mikael Fornius

reply via email to

[Prev in Thread] Current Thread [Next in Thread]