mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-14 16:51:15 +00:00
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.
This commit is contained in:
parent
b81fae4c3f
commit
aeb35b7995
@ -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
|
||||
|
@ -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)))
|
||||
|
Loading…
Reference in New Issue
Block a user