org-agenda: Fix repeats with nil `org-agenda-repeating-timestamp-show-all'

* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-deadlines):
(org-agenda-get-scheduled): When
`org-agenda-repeating-timestamp-show-all' is nil, only display repeat
before and repeat after today (or only repeat at today if those
coincide).  Also, computations of warnings are done with last repeat
before today instead of base date.
This commit is contained in:
Nicolas Goaziou 2016-12-02 10:55:49 +01:00
parent 6d5e207c7d
commit 9950252f34

View file

@ -5653,13 +5653,19 @@ displayed in agenda view."
(throw :skip nil)) (throw :skip nil))
;; When time-stamp doesn't match CURRENT but has a repeater, ;; When time-stamp doesn't match CURRENT but has a repeater,
;; make sure it repeats on CURRENT. Furthermore, if ;; make sure it repeats on CURRENT. Furthermore, if
;; SHOW-ALL is nil, ensure that repeater is the very first ;; SHOW-ALL is nil, ensure that repeats are only the first
;; one to trigger since today. ;; before and the first after today.
(when (and repeat (when (and repeat
(let ((base (if show-all current today))) (if show-all
(/= current (/= current
(org-agenda--timestamp-to-absolute (org-agenda--timestamp-to-absolute
repeat base 'future (current-buffer) pos)))) repeat current 'future (current-buffer) pos))
(and (/= current
(org-agenda--timestamp-to-absolute
repeat today 'past (current-buffer) pos))
(/= current
(org-agenda--timestamp-to-absolute
repeat today 'future (current-buffer) pos)))))
(throw :skip nil)) (throw :skip nil))
(save-excursion (save-excursion
(re-search-backward org-outline-regexp-bol nil t) (re-search-backward org-outline-regexp-bol nil t)
@ -6065,11 +6071,14 @@ specification like [h]h:mm."
(member todo-state (member todo-state
org-agenda-repeating-timestamp-show-all))) org-agenda-repeating-timestamp-show-all)))
;; DEADLINE is the bare deadline date, i.e., without ;; DEADLINE is the bare deadline date, i.e., without
;; any repeater. REPEAT is closest repeat after ;; any repeater, or the last repeat if SHOW-ALL is
;; CURRENT, if all repeated time stamps are to be ;; non-nil. REPEAT is closest repeat after CURRENT, if
;; shown, or after TODAY otherwise. REPEAT only ;; all repeated time stamps are to be shown, or after
;; applies to future dates. ;; TODAY otherwise. REPEAT only applies to future
(deadline (org-agenda--timestamp-to-absolute s)) ;; dates.
(deadline (if show-all (org-agenda--timestamp-to-absolute s)
(org-agenda--timestamp-to-absolute
s today 'past (current-buffer) pos)))
(repeat (repeat
(if (< current today) deadline (if (< current today) deadline
(org-agenda--timestamp-to-absolute (org-agenda--timestamp-to-absolute
@ -6225,11 +6234,14 @@ scheduled items with an hour specification like [h]h:mm."
(member todo-state (member todo-state
org-agenda-repeating-timestamp-show-all))) org-agenda-repeating-timestamp-show-all)))
;; SCHEDULE is the bare scheduled date, i.e., without ;; SCHEDULE is the bare scheduled date, i.e., without
;; any repeater. REPEAT is the closest repeat after ;; any repeater if non-nil, or last repeat if SHOW-ALL
;; CURRENT, if all repeated time stamps are to be ;; is nil. REPEAT is the closest repeat after CURRENT,
;; shown, or after TODAY otherwise. REPEAT only ;; if all repeated time stamps are to be shown, or
;; applies to future dates. ;; after TODAY otherwise. REPEAT only applies to
(schedule (org-agenda--timestamp-to-absolute s)) ;; future dates.
(schedule (if show-all (org-agenda--timestamp-to-absolute s)
(org-agenda--timestamp-to-absolute
s today 'past (current-buffer) pos)))
(repeat (cond ((< current today) schedule) (repeat (cond ((< current today) schedule)
(show-all (show-all
(org-agenda--timestamp-to-absolute (org-agenda--timestamp-to-absolute