From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikael Fornius Subject: [org-habit] Problem when last DONE date is earlier than `org-habit-preceding-days' Date: Thu, 22 Oct 2009 12:17:12 +0200 Message-ID: <87eiovbumv.fsf@eee.in> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N0ui9-00048P-UN for emacs-orgmode@gnu.org; Thu, 22 Oct 2009 06:16:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N0ui4-00043h-Du for emacs-orgmode@gnu.org; Thu, 22 Oct 2009 06:16:00 -0400 Received: from [199.232.76.173] (port=56803 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0ui4-00043U-5W for emacs-orgmode@gnu.org; Thu, 22 Oct 2009 06:15:56 -0400 Received: from violet.abc.se ([62.80.200.155]:34740) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N0ui3-0008UX-HS for emacs-orgmode@gnu.org; Thu, 22 Oct 2009 06:15:56 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=patch Content-Description: patch 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--