mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-31 20:48:37 +00:00
Fixes to the consistency graph in org-habit
This commit is contained in:
parent
156cfd92ae
commit
be2806d281
@ -1,5 +1,11 @@
|
||||
2009-10-22 John Wiegley <jwiegley@gmail.com>
|
||||
|
||||
* org-habit.el (org-habit-parse-todo): Generate an error if a
|
||||
habit has a scheduled repeat period < 1.
|
||||
(org-habit-get-faces): Fixes to the way that colors are computed.
|
||||
(org-habit-build-graph): The graph wasn't displaying beyond any
|
||||
day that had two completions in it.
|
||||
|
||||
* org.el (org-modules): Made this variable more consistent, since
|
||||
it was referring to Org, OrgMode and Org-mode, whereas the docs
|
||||
for the variable always refer to Org-mode.
|
||||
|
@ -167,6 +167,8 @@ This list represents a \"habit\" for the rest of this module."
|
||||
(error "Habit has no scheduled date"))
|
||||
(unless scheduled-repeat
|
||||
(error "Habit has no scheduled repeat period"))
|
||||
(unless (> sr-days 0)
|
||||
(error "Habit's scheduled repeat period is less than 1d"))
|
||||
(when (string-match "/\\([0-9]+[dwmy]\\)" scheduled-repeat)
|
||||
(setq dr-days (org-habit-duration-to-days
|
||||
(match-string-no-properties 1 scheduled-repeat)))
|
||||
@ -236,26 +238,29 @@ Habits are assigned colors on the following basis:
|
||||
(unless moment (setq moment (current-time)))
|
||||
(let* ((scheduled (or scheduled-time (org-habit-scheduled habit)))
|
||||
(s-repeat (org-habit-scheduled-repeat habit))
|
||||
(scheduled-end (time-add scheduled (days-to-time s-repeat)))
|
||||
(scheduled-end (time-add scheduled (days-to-time (1- s-repeat))))
|
||||
(d-repeat (org-habit-deadline-repeat habit))
|
||||
(deadline (if (and scheduled-time d-repeat)
|
||||
(time-add scheduled-time
|
||||
(days-to-time (- d-repeat s-repeat)))
|
||||
(org-habit-deadline habit))))
|
||||
(org-habit-deadline habit)))
|
||||
(m-days (time-to-days moment))
|
||||
(s-days (time-to-days scheduled))
|
||||
(s-end-days (time-to-days scheduled-end))
|
||||
(d-days (and deadline (time-to-days deadline))))
|
||||
(cond
|
||||
((time-less-p moment scheduled)
|
||||
((< m-days s-days)
|
||||
'(org-habit-clear-face . org-habit-clear-future-face))
|
||||
((time-less-p moment scheduled-end)
|
||||
((or (< m-days s-end-days)
|
||||
(and deadline (< m-days d-days)))
|
||||
'(org-habit-ready-face . org-habit-ready-future-face))
|
||||
((and deadline
|
||||
(time-less-p moment deadline))
|
||||
((and deadline (< m-days d-days))
|
||||
(if donep
|
||||
'(org-habit-ready-face . org-habit-ready-future-face)
|
||||
'(org-habit-warning-face . org-habit-warning-future-face)))
|
||||
((= (time-to-days moment)
|
||||
(if deadline
|
||||
(time-to-days deadline)
|
||||
(time-to-days scheduled-end)))
|
||||
((= m-days (if deadline
|
||||
d-days
|
||||
s-end-days))
|
||||
(if donep
|
||||
'(org-habit-ready-face . org-habit-ready-future-face)
|
||||
'(org-habit-alert-face . org-habit-alert-future-face)))
|
||||
@ -298,9 +303,11 @@ Habits are assigned colors on the following basis:
|
||||
(if donep
|
||||
(progn
|
||||
(aset graph index ?*)
|
||||
(setq last-done-date (car done-dates)
|
||||
done-dates (cdr done-dates)
|
||||
markedp t))
|
||||
(setq markedp t)
|
||||
(while (and done-dates
|
||||
(= now-days (time-to-days (car done-dates))))
|
||||
(setq last-done-date (car done-dates)
|
||||
done-dates (cdr done-dates))))
|
||||
(if todayp
|
||||
(aset graph index ?!)))
|
||||
(setq face (if (or in-the-past-p
|
||||
|
Loading…
Reference in New Issue
Block a user