summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Lee <jjl@pobox.com>2019-02-03 12:35:39 +0000
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-06 22:29:21 +0100
commitba1fba147f0ad14319870cb49a2e2675c8462f2b (patch)
tree82336160001773818bf3c49273f5748ec86552ff
parent230cc1ee076220673a1ca4800e3e43ee026ec443 (diff)
downloadorg-mode-ba1fba147f0ad14319870cb49a2e2675c8462f2b.tar.gz
org-habit: Add org-habit-scheduled-past-days
* lisp/org-habit.el (org-habit-scheduled-past-days): New variable * lisp/org-agenda.el (org-agenda-get-scheduled): override `org-scheduled-past-days' for habits if `org-habit-scheduled-past-days` is not nil TINYCHANGE
-rw-r--r--lisp/org-agenda.el4
-rw-r--r--lisp/org-habit.el15
2 files changed, 18 insertions, 1 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 489ecec..784a555 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -90,6 +90,7 @@
(defvar org-habit-show-habits)
(defvar org-habit-show-habits-only-for-today)
(defvar org-habit-show-all-today)
+(defvar org-habit-scheduled-past-days)
;; Defined somewhere in this file, but used before definition.
(defvar org-agenda-buffer-name "*Org Agenda*")
@@ -6201,7 +6202,8 @@ scheduled items with an hour specification like [h]h:mm."
habitp
(bound-and-true-p org-habit-show-all-today))
(when (or (and (> ddays 0) (< diff ddays))
- (> diff org-scheduled-past-days)
+ (> diff (or (and habitp org-habit-scheduled-past-days)
+ org-scheduled-past-days))
(> schedule current)
(and (/= current schedule)
(/= current today)
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index af45207..88df38c 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -89,6 +89,21 @@ It will be green even if it was done after the deadline."
:group 'org-habit
:type 'boolean)
+(defcustom org-habit-scheduled-past-days nil
+"Value to use instead of `org-scheduled-past-days', for habits only.
+
+If nil, `org-scheduled-past-days' is used.
+
+Setting this to say 10000 is a way to make habits always show up
+as a reminder, even if you set `org-scheduled-past-days' to a
+small value because you regard scheduled items as a way of
+\"turning on\" TODO items on a particular date, rather than as a
+means of creating calendar-based reminders."
+ :group 'org-habit
+ :type '(choice integer (const nil))
+ :package-version '(Org . "9.3")
+ :safe (lambda (v) (or (integerp v) (null v))))
+
(defface org-habit-clear-face
'((((background light)) (:background "#8270f9"))
(((background dark)) (:background "blue")))