From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niels Giesen Subject: Re: Patch for bug in adjusting time ranges in Agenda Date: Sun, 16 Oct 2011 18:27:15 +0200 Message-ID: References: <87obxzitcv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf303343cda0ac8e04af6cf68b Return-path: Received: from eggs.gnu.org ([140.186.70.92]:44488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFTYU-0003tQ-M2 for emacs-orgmode@gnu.org; Sun, 16 Oct 2011 12:27:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFTYT-0000Iy-5v for emacs-orgmode@gnu.org; Sun, 16 Oct 2011 12:27:18 -0400 Received: from mail-qw0-f41.google.com ([209.85.216.41]:61685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFTYS-0000Im-TX for emacs-orgmode@gnu.org; Sun, 16 Oct 2011 12:27:17 -0400 Received: by qadb17 with SMTP id b17so2002415qad.0 for ; Sun, 16 Oct 2011 09:27:16 -0700 (PDT) In-Reply-To: <87obxzitcv.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Orgmode --20cf303343cda0ac8e04af6cf68b Content-Type: text/plain; charset=UTF-8 *bump* Has this one slipped through (as I were posting two other patches round the same date, one also having to do with date/time ranges in the agenda -- which were both accepted), or am I just impatient? On Sun, Oct 2, 2011 at 12:24 PM, Niels Giesen wrote: > 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 > 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))) > > -- > 1.7.2.5 > > > #+end_src > > Regards, > niels > -- > http://pft.github.com > -- http://pft.github.com --20cf303343cda0ac8e04af6cf68b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable *bump*

Has this one slipped through (as I were posting t= wo other patches round the same date, one also having to do with date/time = ranges in the agenda -- which were both accepted), or am I just impatient?<= br>
On Sun, Oct 2, 2011 at 12:24 PM, Niels Giese= n <niels.gie= sen@gmail.com> wrote:
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 th= e
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
=C2=A0From 2e6b64dc8dcae0fd312729af96ab10d8d2e9d91b Mon Sep 17 00:00:00 20= 01
=C2=A0From: Niels Giesen <nie= ls.giesen@gmail.com>
=C2=A0Date: Sun, 2 Oct 2011 09:15:21 +0200
=C2=A0Subject: [PATCH] Fix shift-adjusting time and date ranges from withi= n Agenda.

=C2=A0,* org-mode/lisp/org-agenda.el (org-agenda-date-later): Adjust both<= br> =C2=A0 =C2=A0start and end timestamp for a range, and set
=C2=A0 =C2=A0`org-last-changed-timestamp' to a representation of the n= ew range.
=C2=A0---
=C2=A0 lisp/org-agenda.el | =C2=A0 =C2=A08 +++++++-
=C2=A0 1 files changed, 7 insertions(+), 1 deletions(-)

=C2=A0diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
=C2=A0index b1fa5f5..e4c1053 100644
=C2=A0--- a/lisp/org-agenda.el
=C2=A0+++ b/lisp/org-agenda.el
=C2=A0@@ -7517,7 +7517,13 @@ the same tree node, and the headline of the t= ree node in the Org-mode file."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char pos)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (not (org-at-timestamp-p))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (error "Cannot find time stamp")) =C2=A0- =C2=A0 =C2=A0 =C2=A0 (org-timestamp-change arg (or what 'day))= )
=C2=A0+ =C2=A0 =C2=A0 =C2=A0 (org-timestamp-change arg (or what 'day))=
=C2=A0+ =C2=A0 =C2=A0 =C2=A0 (when (org-at-date-range-p)
=C2=A0+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((end org-last-changed-timestamp)= )
=C2=A0+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (re-search-backward org-tr-rege= xp-both)
=C2=A0+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-timestamp-change arg (or w= hat 'day))
=C2=A0+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq org-last-changed-timestam= p
=C2=A0+ =C2=A0 =C2=A0 =C2=A0 =C2=A0(concat org-last-changed-timestamp &quo= t;--" end)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(org-agenda-show-new-time marker org-last-chang= ed-timestamp))
=C2=A0 =C2=A0 =C2=A0 (message "Time stamp changed to %s" org-las= t-changed-timestamp)))

=C2=A0--
=C2=A01.7.2.5


#+end_src

Regards,
niels
--
http://pft.github.com



--
http://pft.github.com
--20cf303343cda0ac8e04af6cf68b--