From f20eef318e9e66481dde560dc5e388e911b28aab Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 15 Oct 2011 23:37:59 +0200 Subject: [PATCH] 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. --- lisp/org-agenda.el | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index b208d1e72..bf03b68cd 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) -- 2.11.4.GIT