org-agenda.el: Fix bug when getting the warning delay of a deadline

* lisp/org-agenda.el (org-agenda-get-deadlines): Fix bug when
getting the warning delay of a deadline.

Thanks to Alex Branham for reporting this.
This commit is contained in:
Bastien 2018-04-26 22:59:36 +02:00
parent b1d084c1ab
commit f21fb8ad3b
1 changed files with 18 additions and 23 deletions

View File

@ -5985,29 +5985,24 @@ specification like [h]h:mm."
(org-agenda--timestamp-to-absolute (org-agenda--timestamp-to-absolute
s base 'future (current-buffer) pos))))) s base 'future (current-buffer) pos)))))
(diff (- deadline current)) (diff (- deadline current))
(suppress-prewarning (wdays
(let ((scheduled (cond
(and org-agenda-skip-deadline-prewarning-if-scheduled ;; The current item has a scheduled date, so
(org-entry-get nil "SCHEDULED")))) ;; evaluate its prewarning lead time.
(cond ((integerp org-agenda-skip-deadline-prewarning-if-scheduled)
((not scheduled) nil) ;; Use global prewarning-restart lead time.
;; The current item has a scheduled date, so org-agenda-skip-deadline-prewarning-if-scheduled)
;; evaluate its prewarning lead time. ((eq org-agenda-skip-deadline-prewarning-if-scheduled
((integerp org-agenda-skip-deadline-prewarning-if-scheduled) 'pre-scheduled)
;; Use global prewarning-restart lead time. ;; Set pre-warning to no earlier than SCHEDULED.
org-agenda-skip-deadline-prewarning-if-scheduled) (min (- deadline
((eq org-agenda-skip-deadline-prewarning-if-scheduled (org-agenda--timestamp-to-absolute
'pre-scheduled) (org-entry-get nil "SCHEDULED")))
;; Set pre-warning to no earlier than SCHEDULED. org-deadline-warning-days))
(min (- deadline ;; Set pre-warning to 0
(org-agenda--timestamp-to-absolute scheduled)) (org-agenda-skip-deadline-prewarning-if-scheduled 0)
org-deadline-warning-days)) ;; Set pre-warning to deadline.
;; Set pre-warning to deadline. (t (org-get-wdays s)))))
(t 0))))
(wdays (if suppress-prewarning
(let ((org-deadline-warning-days suppress-prewarning))
(org-get-wdays s))
(org-get-wdays s))))
(cond (cond
;; Only display deadlines at their base date, at future ;; Only display deadlines at their base date, at future
;; repeat occurrences or in today agenda. ;; repeat occurrences or in today agenda.