Function: org-habit-get-priority
org-habit-get-priority is a byte-compiled function defined in
org-habit.el.gz.
Signature
(org-habit-get-priority HABIT &optional MOMENT)
Documentation
Determine the relative priority of a habit.
This must take into account not just urgency, but consistency as well.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-habit.el.gz
(defsubst org-habit-get-priority (habit &optional moment)
"Determine the relative priority of a habit.
This must take into account not just urgency, but consistency as well."
(let ((pri 1000)
(now (if moment (time-to-days moment) (org-today)))
(scheduled (org-habit-scheduled habit))
(deadline (org-habit-deadline habit)))
;; add 10 for every day past the scheduled date, and subtract for every
;; day before it
(setq pri (+ pri (* (- now scheduled) 10)))
;; add 50 if the deadline is today
(if (and (/= scheduled deadline)
(= now deadline))
(setq pri (+ pri 50)))
;; add 100 for every day beyond the deadline date, and subtract 10 for
;; every day before it
(let ((slip (- now (1- deadline))))
(if (> slip 0)
(setq pri (+ pri (* slip 100)))
(setq pri (+ pri (* slip 10)))))
pri))