summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-03-07 01:06:33 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-03-07 08:46:38 +0100
commitd73942cf99c8bf610e56b777615f2c5e09cb0b0b (patch)
tree7e8d58d7aa66bd86b0e75a22137b5aa9975772b6
parenteb1847e29c4216ec3b79029c3f143c9991e61a1b (diff)
downloadorg-mode-d73942cf99c8bf610e56b777615f2c5e09cb0b0b.tar.gz
org-agenda: Implement `org-deadline-past-days'
* lisp/org-agenda.el (org-deadline-past-days): New variable. (org-scheduled-past-days): Set :safe keyword. (org-agenda-get-deadlines): Use new variable.
-rw-r--r--etc/ORG-NEWS2
-rw-r--r--lisp/org-agenda.el36
2 files changed, 26 insertions, 12 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 29593b4..aa0c7dc 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -86,6 +86,8 @@ docstrings.
*** Agenda
**** New variable : ~org-agenda-show-future-repeats~
**** New variable : ~org-agenda-prefer-last-repeat~
+**** New variable : ~org-deadline-past-days~
+See docstring for details.
**** Binding C-c C-x < for ~org-agenda-set-restriction-lock-from-agenda~
*** New value for ~org-publish-sitemap-sort-folders~
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index c98c328..0a47836 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1292,7 +1292,19 @@ When an item is scheduled on a date, it shows up in the agenda on
this day and will be listed until it is marked done or for the
number of days given here."
:group 'org-agenda-daily/weekly
- :type 'integer)
+ :type 'integer
+ :safe 'integerp)
+
+(defcustom org-deadline-past-days 10000
+ "Number of days to warn about missed deadlines.
+When an item has deadline on a date, it shows up in the agenda on
+this day and will appear as a reminder until it is marked DONE or
+for the number of days given here."
+ :group 'org-agenda-daily/weekly
+ :type 'integer
+ :version "26.1"
+ :package-version '(Org . "9.1")
+ :safe 'integerp)
(defcustom org-agenda-log-mode-items '(closed clock)
"List of items that should be shown in agenda log mode.
@@ -5954,17 +5966,17 @@ specification like [h]h:mm."
(let ((org-deadline-warning-days suppress-prewarning))
(org-get-wdays s))
(org-get-wdays s))))
- ;; Display deadlines items at base date (DEADLINE), today,
- ;; if deadline is overdue or if the expiration of the
- ;; upcoming deadline is within WDAYS warning time. Also,
- ;; show any repeat past today.
- (when (or (and (/= current deadline)
- (/= current today)
- (/= current repeat))
- (and today?
- (> deadline current)
- (> diff wdays)))
- (throw :skip nil))
+ (cond
+ ;; Only display deadlines at their base date, at future
+ ;; repeat occurrences or in today agenda.
+ ((= current deadline) nil)
+ ((= current repeat) nil)
+ ((not today?) (throw :skip nil))
+ ;; Upcoming deadline: display within warning period WDAYS.
+ ((> deadline current) (when (> diff wdays) (throw :skip nil)))
+ ;; Overdue deadline: warn about it for
+ ;; `org-deadline-past-days' duration.
+ (t (when (< org-deadline-past-days (- diff)) (throw :skip nil))))
;; Possibly skip done tasks.
(when (and done?
(or org-agenda-skip-deadline-if-done