Update all ++ repeaters in an entry

* lisp/org.el (org-auto-repeat-maybe): Fix shifting multiple time stamps.

See http://www.mail-archive.com/emacs-orgmode@gnu.org/msg30284.html.

Patch by Andrew Korty
This commit is contained in:
Carsten Dominik 2010-10-22 09:57:28 +02:00
parent 9dc28ea0ed
commit a841867856
1 changed files with 11 additions and 10 deletions

View File

@ -11438,7 +11438,6 @@ This function is run automatically after each state change to a DONE state."
(msg "Entry repeats: ")
(org-log-done nil)
(org-todo-log-states nil)
(nshiftmax 10) (nshift 0)
re type n what ts time to-state)
(when repeat
(if (eq org-log-repeat t) (setq org-log-repeat 'state))
@ -11485,15 +11484,17 @@ This function is run automatically after each state change to a DONE state."
(- (time-to-days (current-time)) (time-to-days time))
'day))
((equal (match-string 1 ts) "+")
(while (or (= nshift 0)
(<= (time-to-days time) (time-to-days (current-time))))
(when (= (incf nshift) nshiftmax)
(or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today. Continue? " nshift))
(error "Abort")))
(org-timestamp-change n (cdr (assoc what whata)))
(org-at-timestamp-p t)
(setq ts (match-string 1))
(setq time (save-match-data (org-time-string-to-time ts))))
(let ((nshiftmax 10) (nshift 0))
(while (or (= nshift 0)
(<= (time-to-days time)
(time-to-days (current-time))))
(when (= (incf nshift) nshiftmax)
(or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today. Continue? " nshift))
(error "Abort")))
(org-timestamp-change n (cdr (assoc what whata)))
(org-at-timestamp-p t)
(setq ts (match-string 1))
(setq time (save-match-data (org-time-string-to-time ts)))))
(org-timestamp-change (- n) (cdr (assoc what whata)))
;; rematch, so that we have everything in place for the real shift
(org-at-timestamp-p t)