* [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days'
@ 2009-10-22 10:17 Mikael Fornius
2009-10-22 10:29 ` John Wiegley
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Fornius @ 2009-10-22 10:17 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 377 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 730 bytes --]
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))
[-- Attachment #3: Type: text/plain, Size: 20 bytes --]
--
Mikael Fornius
[-- Attachment #4: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days'
2009-10-22 10:17 [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days' Mikael Fornius
@ 2009-10-22 10:29 ` John Wiegley
0 siblings, 0 replies; 2+ messages in thread
From: John Wiegley @ 2009-10-22 10:29 UTC (permalink / raw)
To: Mikael Fornius; +Cc: emacs-orgmode
On Oct 22, 2009, at 6:17 AM, Mikael Fornius wrote:
> 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.
Your fix is correct, I've submitted a patch.
John
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-22 10:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-22 10:17 [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days' Mikael Fornius
2009-10-22 10:29 ` John Wiegley
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).