diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2011-10-15 23:37:59 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2011-10-16 11:09:45 +0200 |
commit | f20eef318e9e66481dde560dc5e388e911b28aab (patch) | |
tree | da0015052133704a2651e858c1365589aac2ca0d | |
parent | 85cce6fa855593539537fb72977a11604830f20c (diff) | |
download | org-mode-f20eef318e9e66481dde560dc5e388e911b28aab.tar.gz |
Agenda: New behaviour when shifting scheduled date forward.
* lisp/org-agenda.el (org-agenda-date-later): Make pushing forward
a past date to jump immedialtely to today.
-rw-r--r-- | lisp/org-agenda.el | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index b208d1e..bf03b68 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7526,15 +7526,25 @@ the same tree node, and the headline of the tree node in the Org-mode file." (let* ((marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) (buffer (marker-buffer marker)) - (pos (marker-position marker))) + (pos (marker-position marker)) + cdate today) (org-with-remote-undo buffer - (with-current-buffer buffer - (widen) - (goto-char pos) - (if (not (org-at-timestamp-p)) - (error "Cannot find time stamp")) - (org-timestamp-change arg (or what 'day))) - (org-agenda-show-new-time marker org-last-changed-timestamp)) + (with-current-buffer buffer + (widen) + (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)))) + (org-agenda-show-new-time marker org-last-changed-timestamp)) (message "Time stamp changed to %s" org-last-changed-timestamp))) (defun org-agenda-date-earlier (arg &optional what) |