summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2020-02-01 09:44:14 +0100
committerBastien <bzg@gnu.org>2020-02-01 09:44:14 +0100
commit39c656870cc87e46d8c9baa59b7df48ff60a9b26 (patch)
treeecea418b714d1ad38d49698d3552b2b70ee68a9e
parent04bd110b2b3fbf0a5381723018d1525d69b48949 (diff)
downloadorg-mode-39c656870cc87e46d8c9baa59b7df48ff60a9b26.tar.gz
org-agenda.el: Fix handling of one-time delays
* lisp/org-agenda.el (org-agenda-get-scheduled): Fix handling of one-time delays. Thanks to hhkg for reporting this.
-rw-r--r--lisp/org-agenda.el30
1 files changed, 23 insertions, 7 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index d9189b5..611afa0 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6275,6 +6275,10 @@ scheduled items with an hour specification like [h]h:mm."
(org-agenda--timestamp-to-absolute deadline))
org-scheduled-delay-days))
(t 0))))
+ (diff-r (abs (- repeat current)))
+ (ddays-once (or (and (string-match "--\\([0-9]+\\)[hdwmy]" s)
+ (string-to-number (match-string 1 s)))
+ 0))
(ddays
(cond
;; Nullify delay when a repeater triggered already
@@ -6293,13 +6297,25 @@ scheduled items with an hour specification like [h]h:mm."
(unless (and todayp
habitp
(bound-and-true-p org-habit-show-all-today))
- (when (or (and (> ddays 0) (< diff ddays))
- (> diff (or (and habitp org-habit-scheduled-past-days)
- org-scheduled-past-days))
- (> schedule current)
- (and (/= current schedule)
- (/= current today)
- (/= current repeat)))
+ (when (or
+ ;; no one-time delay, not repeated delay
+ (and (not ddays-once) (not (= ddays diff-r)))
+ ;; one-time delay, but not for today
+ (and ddays-once
+ (not (= diff diff-r))
+ (= ddays-once diff-r))
+ ;; normal delay, but already in the past
+ (and (> ddays 0) (< diff ddays))
+ ;; a habit, but past `org-habit-scheduled-past-days'
+ (> diff (or (and habitp org-habit-scheduled-past-days)
+ org-scheduled-past-days))
+ ;; schedule in the future
+ (> schedule current)
+ ;; no delay, not scheduled today, no deadline for today
+ (and (= ddays 0)
+ (/= current schedule)
+ (/= current today)
+ (/= current repeat)))
(throw :skip nil)))
;; Possibly skip done tasks.
(when (and donep