Browse Source

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.
Bastien 1 year ago
parent
commit
f21fb8ad3b
1 changed files with 18 additions and 23 deletions
  1. 18 23
      lisp/org-agenda.el

+ 18 - 23
lisp/org-agenda.el

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