summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2011-10-21 10:07:02 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2011-10-21 10:07:02 +0200
commit7caa7e1ff76e5a5b58f4146a76266258c3137f6c (patch)
treea7524ee3a01d915a99fa5fc1588d969e51650d78
parent94873e2767b649867f17b03fc2594332f6ce7c94 (diff)
downloadorg-mode-7caa7e1ff76e5a5b58f4146a76266258c3137f6c.tar.gz
Fix shifting of data ranges.
* lisp/org-agenda.el (org-agenda-date-later): Fix shifting of date ranges. Patch based on code by Niels Giesen. TINYCHANGE
-rw-r--r--lisp/org-agenda.el28
1 files changed, 18 insertions, 10 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index bf03b68..3d89c63 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7534,16 +7534,24 @@ the same tree node, and the headline of the tree node in the Org-mode file."
(goto-char pos)
(if (not (org-at-timestamp-p))
(error "Cannot find time stamp"))
- (setq cdate (org-parse-time-string (match-string 0) 'nodefault)
- cdate (calendar-absolute-from-gregorian
- (list (nth 4 cdate) (nth 3 cdate) (nth 5 cdate)))
- today (org-today))
- (if (and (equal arg 1)
- (or (not what) (eq what 'day))
- (> today cdate))
- ;; immediately shift to today
- (org-timestamp-change (- today cdate) 'day)
- (org-timestamp-change arg (or what 'day))))
+ (when (and org-agenda-move-date-from-past-immediately-to-today
+ (not (save-match-data (org-at-date-range-p))))
+ (setq cdate (org-parse-time-string (match-string 0) 'nodefault)
+ cdate (calendar-absolute-from-gregorian
+ (list (nth 4 cdate) (nth 3 cdate) (nth 5 cdate)))
+ today (org-today))
+ (if (and (equal arg 1)
+ (or (not what) (eq what 'day))
+ (> today cdate))
+ ;; immediately shift to today
+ (setq arg (- today cdate))))
+ (org-timestamp-change arg (or what 'day))
+ (when (and (org-at-date-range-p)
+ (re-search-backward org-tr-regexp-both (point-at-bol)))
+ (let ((end org-last-changed-timestamp))
+ (org-timestamp-change arg (or what 'day))
+ (setq org-last-changed-timestamp
+ (concat org-last-changed-timestamp "--" end)))))
(org-agenda-show-new-time marker org-last-changed-timestamp))
(message "Time stamp changed to %s" org-last-changed-timestamp)))