1 files changed, 30 insertions, 15 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index fbe5cc1..bac51ce 100644
@@ -827,9 +827,10 @@ deadlines are always turned off when the item is DONE."
This will apply on all days where a prewarning for the deadline would
be shown, but not at the day when the entry is actually due. On that day,
the deadline will be shown anyway.
-This variable may be set to nil, t, or a number which will then give
-the number of days before the actual deadline when the prewarnings
+This variable may be set to nil, t, the symbol `pre-scheduled',
+or a number which will then give the number of days before the actual
+deadline when the prewarnings should resume. The symbol `pre-scheduled'
+eliminates the deadline prewarning only prior to the scheduled date.
This can be used in a workflow where the first showing of the deadline will
trigger you to schedule it, and then you don't want to be reminded of it
because you will take care of it on the day when scheduled."
@@ -838,6 +839,7 @@ because you will take care of it on the day when scheduled."
(const :tag "Always show prewarning" nil)
+ (const :tag "Remove prewarning prior to scheduled date" pre-scheduled)
(const :tag "Remove prewarning if entry is scheduled" t)
(integer :tag "Restart prewarning N days before deadline")))
@@ -5813,18 +5815,8 @@ See also the user option `org-agenda-clock-consistency-checks'."
show-all upcomingp donep timestr warntime)
(while (re-search-forward regexp nil t)
- (setq suppress-prewarning nil)
- (when (and org-agenda-skip-deadline-prewarning-if-scheduled
- (string-match org-scheduled-time-regexp
- (buffer-substring (point-at-bol)
- (setq suppress-prewarning
- (if (integerp org-agenda-skip-deadline-prewarning-if-scheduled)
(setq s (match-string 1)
pos (1- (match-beginning 1))
@@ -5835,8 +5827,31 @@ See also the user option `org-agenda-clock-consistency-checks'."
(match-string 1) d1 'past show-all
- diff (- d2 d1)
- wdays (if suppress-prewarning
+ diff (- d2 d1))
+ (setq suppress-prewarning
+ (let ((ds (and org-agenda-skip-deadline-prewarning-if-scheduled
+ (let ((item (buffer-substring (point-at-bol)
+ (and (string-match
+ org-scheduled-time-regexp item)
+ (match-string 1 item)))))))
+ (if ds
+ ;; The current item has a scheduled date (in ds),
+ ;; so evaluate its prewarning lead time.
+ ;; Use globally-customized prewarning-restart lead time.
+ ((eq org-agenda-skip-deadline-prewarning-if-scheduled
+ ;; Set prewarning to no earlier than scheduled.
+ (min (- d2 (org-time-string-to-absolute
+ ds d1 'past show-all (current-buffer) pos))
+ (t 0))))) ;; Set prewarning to deadline.
+ (setq wdays (if suppress-prewarning
(let ((org-deadline-warning-days suppress-prewarning))