summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames TD Smith <ahktenzero@mohorovi.cc>2009-11-12 01:46:18 +0000
committerJames TD Smith <ahktenzero@mohorovi.cc>2009-11-12 01:46:18 +0000
commitaeb35b79951ee54b45c963093fd63a65af546d65 (patch)
treeee0008421cae7d2de27c2ed8866a160b103956ec
parentb81fae4c3fa39a15bda5e58016fe9dec28e38c18 (diff)
downloadorg-mode-aeb35b79951ee54b45c963093fd63a65af546d65.tar.gz
Improve error reporting in org-habit.
Include the entry in the error messages in org-habit-parse-todo. This makes it much easier to find the heading you need to fix.
-rwxr-xr-xlisp/ChangeLog3
-rw-r--r--lisp/org-habit.el18
2 files changed, 13 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a72824d..4b89fc7 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2009-11-12 James TD Smith <ahktenzero@mohorovi.cc>
+ * org-habit.el (org-habit-parse-todo): Indicate which habit is
+ wrongly set up in the error messages.
+
* org-colview.el (org-columns-display-here): Don't try to
calculate values if the underlying property is not set.
(org-columns-string-to-number): Convert age strings back into
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 4bb311e..75bcc38 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -149,19 +149,21 @@ This list represents a \"habit\" for the rest of this module."
(scheduled-repeat (org-get-repeat org-scheduled-string))
(sr-days (org-habit-duration-to-days scheduled-repeat))
(end (org-entry-end-position))
+ (habit-entry (org-no-properties (nth 5 (org-heading-components))))
closed-dates deadline dr-days)
(if scheduled
(setq scheduled (time-to-days scheduled))
- (error "Habit has no scheduled date"))
+ (error "Habit %s has no scheduled date" habit-entry))
(unless scheduled-repeat
- (error "Habit has no scheduled repeat period"))
+ (error "Habit %s has no scheduled repeat period" habit-entry))
(unless (> sr-days 0)
- (error "Habit's scheduled repeat period is less than 1d"))
+ (error "Habit %s scheduled repeat period is less than 1d" habit-entry))
(when (string-match "/\\([0-9]+[dwmy]\\)" scheduled-repeat)
(setq dr-days (org-habit-duration-to-days
(match-string-no-properties 1 scheduled-repeat)))
(if (<= dr-days sr-days)
- (error "Habit's deadline repeat period is less than or equal to scheduled"))
+ (error "Habit %s deadline repeat period is less than or equal to scheduled (%s)"
+ habit-entry scheduled-repeat))
(setq deadline (+ scheduled (- dr-days sr-days))))
(org-back-to-heading t)
(while (re-search-forward "- State \"DONE\".*\\[\\([^]]+\\)\\]" end t)
@@ -218,13 +220,13 @@ SCHEDULED-DAYS defaults to the habit's actual scheduled days if nil.
Habits are assigned colors on the following basis:
Blue Task is before the scheduled date.
Green Task is on or after scheduled date, but before the
- end of the schedule's repeat period.
+ end of the schedule's repeat period.
Yellow If the task has a deadline, then it is after schedule's
- repeat period, but before the deadline.
+ repeat period, but before the deadline.
Orange The task has reached the deadline day, or if there is
- no deadline, the end of the schedule's repeat period.
+ no deadline, the end of the schedule's repeat period.
Red The task has gone beyond the deadline day or the
- schedule's repeat period."
+ schedule's repeat period."
(let* ((scheduled (or scheduled-days (org-habit-scheduled habit)))
(s-repeat (org-habit-scheduled-repeat habit))
(scheduled-end (+ scheduled (1- s-repeat)))