diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2011-10-21 10:07:02 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2011-10-21 10:07:02 +0200 |
commit | 7caa7e1ff76e5a5b58f4146a76266258c3137f6c (patch) | |
tree | a7524ee3a01d915a99fa5fc1588d969e51650d78 | |
parent | 94873e2767b649867f17b03fc2594332f6ce7c94 (diff) | |
download | org-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.el | 28 |
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))) |