[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Patch for bug in adjusting time ranges in Agenda

From: Niels Giesen
Subject: [O] Patch for bug in adjusting time ranges in Agenda
Date: Sun, 02 Oct 2011 12:24:32 +0200

Hi Orgers,

The discussion in the recent thread "Time range end in agenda view not
displayed" prompted me to take a closer look at time/date ranges in the
Agenda view. I noticed that the commands `org-agenda-do-date-later' and
`org-agenda-do-date-earlier' do not work correctly on timestamp ranges,
in that they only shift the rightmost timestamp in the range. The patch
below should fix this.

#+begin_src diff
  From 2e6b64dc8dcae0fd312729af96ab10d8d2e9d91b Mon Sep 17 00:00:00 2001
  From: Niels Giesen <address@hidden>
  Date: Sun, 2 Oct 2011 09:15:21 +0200
  Subject: [PATCH] Fix shift-adjusting time and date ranges from within Agenda.
  ,* org-mode/lisp/org-agenda.el (org-agenda-date-later): Adjust both
    start and end timestamp for a range, and set
    `org-last-changed-timestamp' to a representation of the new range.
   lisp/org-agenda.el |    8 +++++++-
   1 files changed, 7 insertions(+), 1 deletions(-)
  diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
  index b1fa5f5..e4c1053 100644
  --- a/lisp/org-agenda.el
  +++ b/lisp/org-agenda.el
  @@ -7517,7 +7517,13 @@ 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"))
  -       (org-timestamp-change arg (or what 'day)))
  +       (org-timestamp-change arg (or what 'day))
  +       (when (org-at-date-range-p)
  +         (let ((end org-last-changed-timestamp))
  +           (re-search-backward org-tr-regexp-both)
  +           (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)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]