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.
This commit is contained in:
Nicolas Goaziou 2017-03-07 01:06:33 +01:00
parent eb1847e29c
commit d73942cf99
2 changed files with 26 additions and 12 deletions

View File

@ -86,6 +86,8 @@ docstrings.
*** Agenda *** Agenda
**** New variable : ~org-agenda-show-future-repeats~ **** New variable : ~org-agenda-show-future-repeats~
**** New variable : ~org-agenda-prefer-last-repeat~ **** 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~ **** Binding C-c C-x < for ~org-agenda-set-restriction-lock-from-agenda~
*** New value for ~org-publish-sitemap-sort-folders~ *** New value for ~org-publish-sitemap-sort-folders~

View File

@ -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 this day and will be listed until it is marked done or for the
number of days given here." number of days given here."
:group 'org-agenda-daily/weekly :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) (defcustom org-agenda-log-mode-items '(closed clock)
"List of items that should be shown in agenda log mode. "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)) (let ((org-deadline-warning-days suppress-prewarning))
(org-get-wdays s)) (org-get-wdays s))
(org-get-wdays s)))) (org-get-wdays s))))
;; Display deadlines items at base date (DEADLINE), today, (cond
;; if deadline is overdue or if the expiration of the ;; Only display deadlines at their base date, at future
;; upcoming deadline is within WDAYS warning time. Also, ;; repeat occurrences or in today agenda.
;; show any repeat past today. ((= current deadline) nil)
(when (or (and (/= current deadline) ((= current repeat) nil)
(/= current today) ((not today?) (throw :skip nil))
(/= current repeat)) ;; Upcoming deadline: display within warning period WDAYS.
(and today? ((> deadline current) (when (> diff wdays) (throw :skip nil)))
(> deadline current) ;; Overdue deadline: warn about it for
(> diff wdays))) ;; `org-deadline-past-days' duration.
(throw :skip nil)) (t (when (< org-deadline-past-days (- diff)) (throw :skip nil))))
;; Possibly skip done tasks. ;; Possibly skip done tasks.
(when (and done? (when (and done?
(or org-agenda-skip-deadline-if-done (or org-agenda-skip-deadline-if-done