emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mikael Fornius <mfo@abc.se>
To: emacs-orgmode@gnu.org
Subject: [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days'
Date: Thu, 22 Oct 2009 12:17:12 +0200	[thread overview]
Message-ID: <87eiovbumv.fsf@eee.in> (raw)

[-- 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

             reply	other threads:[~2009-10-22 10:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-22 10:17 Mikael Fornius [this message]
2009-10-22 10:29 ` [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days' John Wiegley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eiovbumv.fsf@eee.in \
    --to=mfo@abc.se \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).