emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Display of time/date ranges in the agenda
@ 2011-01-05 12:58 Tassilo Horn
  2011-01-05 16:46 ` Michael Brand
  2011-01-05 17:15 ` Memnon Anon
  0 siblings, 2 replies; 11+ messages in thread
From: Tassilo Horn @ 2011-01-05 12:58 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I have an entry

** Statustreffen (Bad Homburg)
   <2011-01-17 Mon 12:00>--<2011-01-18 Tue 13:30>

In the agenda, it shows up as:

--8<---------------cut here---------------start------------->8---
Monday     17 January 2011 W03
  uni:        12:00...... (1/2):  Statustreffen (Bad Homburg)
Tuesday    18 January 2011
  uni:        12:00...... (2/2):  Statustreffen (Bad Homburg)
--8<---------------cut here---------------end--------------->8---

As the meeting is finished at 13:30, I'd like to have it shown like
that:

--8<---------------cut here---------------start------------->8---
Monday     17 January 2011 W03
  uni:        12:00...... (1/2):  Statustreffen (Bad Homburg)
Tuesday    18 January 2011
  uni:        ......13:30 (2/2):  Statustreffen (Bad Homburg)
--8<---------------cut here---------------end--------------->8---

Is that possible?  And does the current behavior qualify as a bug?  I
mean, 12:00 is part of the first timestamp, not the second...

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Display of time/date ranges in the agenda
  2011-01-05 12:58 Display of time/date ranges in the agenda Tassilo Horn
@ 2011-01-05 16:46 ` Michael Brand
  2011-01-05 17:15 ` Memnon Anon
  1 sibling, 0 replies; 11+ messages in thread
From: Michael Brand @ 2011-01-05 16:46 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-orgmode

On Wed, Jan 5, 2011 at 13:58, Tassilo Horn <tassilo@member.fsf.org> wrote:
> --8<---------------cut here---------------start------------->8---
> Monday     17 January 2011 W03
>  uni:        12:00...... (1/2):  Statustreffen (Bad Homburg)
> Tuesday    18 January 2011
>  uni:        ......13:30 (2/2):  Statustreffen (Bad Homburg)
> --8<---------------cut here---------------end--------------->8---

I am missing this functionality too.

Until now I have used a weak workaround that shows at least the end
time but that has several other disadvantages: one of them is not
showing the start time, one is that the start day as a whole is shown
only if the current day in the agenda is 2010-01-17 itself:
DEADLINE: <2011-01-18 Tue 13:30 -1d>
And adding a
SCHEDULED: <2011-01-17 Mon 12:00>
would result in a `Sched. 2x:' in the agenda on 2011-01-18 which I don't like.

Michael

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Display of time/date ranges in the agenda
  2011-01-05 12:58 Display of time/date ranges in the agenda Tassilo Horn
  2011-01-05 16:46 ` Michael Brand
@ 2011-01-05 17:15 ` Memnon Anon
  2011-01-06  0:50   ` suvayu ali
  2011-01-06 13:18   ` Tassilo Horn
  1 sibling, 2 replies; 11+ messages in thread
From: Memnon Anon @ 2011-01-05 17:15 UTC (permalink / raw)
  To: emacs-orgmode

Hi Tassilo,

Tassilo Horn <tassilo@member.fsf.org> writes:

> I have an entry
>
> ** Statustreffen (Bad Homburg)
>    <2011-01-17 Mon 12:00>--<2011-01-18 Tue 13:30>
>
> Monday     17 January 2011 W03
>   uni:        12:00...... (1/2):  Statustreffen (Bad Homburg)
> Tuesday    18 January 2011
>   uni:        12:00...... (2/2):  Statustreffen (Bad Homburg)
>

What about:

** Statustreffen (Bad Homburg)
    <2011-01-17 Mon 12:00-23:59>
    <2011-01-18 Tue 00:01-13:30>

I use this for my night shifts...
It is inconvenient for items crossing several days, though.

Memnon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: Display of time/date ranges in the agenda
  2011-01-05 17:15 ` Memnon Anon
@ 2011-01-06  0:50   ` suvayu ali
  2011-01-06 13:18   ` Tassilo Horn
  1 sibling, 0 replies; 11+ messages in thread
From: suvayu ali @ 2011-01-06  0:50 UTC (permalink / raw)
  To: Memnon Anon; +Cc: emacs-orgmode

On Wed, Jan 5, 2011 at 9:15 AM, Memnon Anon
<gegendosenfleisch@googlemail.com> wrote:
> Hi Tassilo,
>
> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> I have an entry
>>
>> ** Statustreffen (Bad Homburg)
>>    <2011-01-17 Mon 12:00>--<2011-01-18 Tue 13:30>
>>
>> Monday     17 January 2011 W03
>>   uni:        12:00...... (1/2):  Statustreffen (Bad Homburg)
>> Tuesday    18 January 2011
>>   uni:        12:00...... (2/2):  Statustreffen (Bad Homburg)
>>
>
> What about:
>
> ** Statustreffen (Bad Homburg)
>    <2011-01-17 Mon 12:00-23:59>
>    <2011-01-18 Tue 00:01-13:30>
>
> I use this for my night shifts...
> It is inconvenient for items crossing several days, though.
>

I had the same problem. My night shifts started @ 23:00 and went up to
07:00. I ended up using a solution like yours:

*** DQ Shifts @ ACR
    :PROPERTIES:
    :CATEGORY: shifts
    :END:
    <2010-12-02 Thu 23:00-24:00>
    <2010-12-03 Fri 00:00-07:00>
    <2010-12-05 Sun 07:00-15:00>


I also wish there was an easy way to specify time zones. Most of my
meetings are scheduled in CET/CEST whereas I am in PST/PDT. This
becomes even worse when I travel, I have to reschedule all my
recurring meetings to my current time zone. But I should probably
start a new thread for these. :)

> Memnon



-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Display of time/date ranges in the agenda
  2011-01-05 17:15 ` Memnon Anon
  2011-01-06  0:50   ` suvayu ali
@ 2011-01-06 13:18   ` Tassilo Horn
  2011-01-06 20:46     ` [PATCH] Properly format start and end times in time ranges. (was: Display of time/date ranges in the agenda) Tassilo Horn
  1 sibling, 1 reply; 11+ messages in thread
From: Tassilo Horn @ 2011-01-06 13:18 UTC (permalink / raw)
  To: emacs-orgmode

Memnon Anon <gegendosenfleisch@googlemail.com> writes:

Hi Memnon,

>> I have an entry
>>
>> ** Statustreffen (Bad Homburg)
>>    <2011-01-17 Mon 12:00>--<2011-01-18 Tue 13:30>
>>
>> Monday     17 January 2011 W03
>>   uni:        12:00...... (1/2):  Statustreffen (Bad Homburg)
>> Tuesday    18 January 2011
>>   uni:        12:00...... (2/2):  Statustreffen (Bad Homburg)
>>
>
> What about:
>
> ** Statustreffen (Bad Homburg)
>     <2011-01-17 Mon 12:00-23:59>
>     <2011-01-18 Tue 00:01-13:30>
>
> I use this for my night shifts...

Hm, well, it's at least a workaround...

> It is inconvenient for items crossing several days, though.

Indeed.  Maybe I find some time to look at the code the next weekend...

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] Properly format start and end times in time ranges. (was: Display of time/date ranges in the agenda)
  2011-01-06 13:18   ` Tassilo Horn
@ 2011-01-06 20:46     ` Tassilo Horn
  2011-02-13  0:40       ` [PATCH] Properly format start and end times in time ranges Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Tassilo Horn @ 2011-01-06 20:46 UTC (permalink / raw)
  To: emacs-orgmode

* org-agenda.el (org-format-agenda-item): Properly format start and
end times in time ranges, i.e., print the start time of the start
date, no times for intermediate dates, and the end time with
preceeding dots for the end date.

With this patch, an entry with time range like this

--8<---------------cut here---------------start------------->8---
** TESTENTRY
   <2011-01-07 Fri 19:05>--<2011-01-09 Sun 16:25>
--8<---------------cut here---------------end--------------->8---

is shown in the agenda as follows:

--8<---------------cut here---------------start------------->8---
Friday      7 January 2011
  private:    19:05...... (1/3):  TESTENTRY
Saturday    8 January 2011
  private:    ........... (2/3):  TESTENTRY
Sunday      9 January 2011
  private:    ......16:25 (3/3):  TESTENTRY
--8<---------------cut here---------------end--------------->8---

Before, "19:05......" was used for all days of the entry.
---
 lisp/org-agenda.el |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index bf36758..3a20e2a 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5164,12 +5164,39 @@ Any match of REMOVE-RE will be removed from TXT."
 	   (ts (if dotime (concat
 			   (if (stringp dotime) dotime "")
 			   (and org-agenda-search-headline-for-time txt))))
-	   (time-of-day (and dotime (org-get-time-of-day ts)))
+	   timerange
+	   (time-of-day (and dotime
+			     (cond
+			      ;; Time ranges
+			      ((string-match "\\(<.*>\\)--\\(<.*>\\)" ts)
+			       (let* ((start (match-string 1 ts))
+				      (end (match-string 2 ts))
+				      (starttime (let ((time (org-parse-time-string start)))
+						   (list (nth 4 time)
+							 (nth 3 time)
+							 (nth 5 time))))
+				      (endtime (let ((time (org-parse-time-string end)))
+						 (list (nth 4 time)
+						       (nth 3 time)
+						       (nth 5 time)))))
+				 (catch 'tod
+				   (when (equal date starttime)
+				     (setq timerange 'start)
+				     (setq time (org-get-time-of-day start 'string))
+				     (throw 'tod (org-get-time-of-day start)))
+				   (when (equal date endtime)
+				     (setq timerange 'end)
+				     (setq time (org-get-time-of-day end 'string))
+				     (throw 'tod (org-get-time-of-day end)))
+				   ;; Don't show a time for in-between dates
+				   (setq timerange 'inbetween)
+				   (throw 'tod nil))))
+			      (t (org-get-time-of-day ts)))))
 	   stamp plain s0 s1 s2 t1 t2 rtn srp l
 	   duration thecategory)
       (and (org-mode-p) buffer-file-name
 	   (add-to-list 'org-agenda-contributing-files buffer-file-name))
-      (when (and dotime time-of-day)
+      (when (and dotime time-of-day (not timerange))
 	;; Extract starting and ending time and move them to prefix
 	(when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts))
 		  (setq plain (string-match org-plain-time-of-day-regexp ts)))
@@ -5243,7 +5270,19 @@ Any match of REMOVE-RE will be removed from TXT."
       (if noprefix
 	  (setq rtn txt)
 	;; Prepare the variables needed in the eval of the compiled format
-	(setq time (cond (s2 (concat
+	(setq time (cond ((eq timerange 'start)
+			  (concat (org-agenda-time-of-day-to-ampm-maybe time)
+				  (if org-agenda-timegrid-use-ampm
+				      "........ "
+				    "......")))
+			 ((eq timerange 'end)
+			  (concat (if org-agenda-timegrid-use-ampm
+				      "........ "
+				    "......")
+				  (org-agenda-time-of-day-to-ampm-maybe time)))
+			 ((eq timerange 'inbetween)
+			  "........... ")
+			 (s2 (concat
 			      (org-agenda-time-of-day-to-ampm-maybe s1)
 			      "-" (org-agenda-time-of-day-to-ampm-maybe s2)
 			      (if org-agenda-timegrid-use-ampm " ")))
-- 
1.7.4.rc1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] Properly format start and end times in time ranges.
  2011-01-06 20:46     ` [PATCH] Properly format start and end times in time ranges. (was: Display of time/date ranges in the agenda) Tassilo Horn
@ 2011-02-13  0:40       ` Bastien
  2011-02-13 10:08         ` Tassilo Horn
  0 siblings, 1 reply; 11+ messages in thread
From: Bastien @ 2011-02-13  0:40 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-orgmode

Hi Tassilo,

Tassilo Horn <tassilo@member.fsf.org> writes:

> * org-agenda.el (org-format-agenda-item): Properly format start and
> end times in time ranges, i.e., print the start time of the start
> date, no times for intermediate dates, and the end time with
> preceeding dots for the end date.

Thanks for the patch, and sorry for the delay in replying.

I couldn't apply the patch against latest git HEAD -- would you 
mind rebasing and resubmit it?  If you don't have time right now
no problem at all -- Julien and I are working on a bigger agenda
change and I'd rather apply your patch after his... 

Thanks for this tiny-but-neat enhancement!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Properly format start and end times in time ranges.
  2011-02-13  0:40       ` [PATCH] Properly format start and end times in time ranges Bastien
@ 2011-02-13 10:08         ` Tassilo Horn
  2011-02-13 10:33           ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Tassilo Horn @ 2011-02-13 10:08 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bastien.guerry@wikimedia.fr> writes:

Hi Bastien,

>> * org-agenda.el (org-format-agenda-item): Properly format start and
>> end times in time ranges, i.e., print the start time of the start
>> date, no times for intermediate dates, and the end time with
>> preceeding dots for the end date.
>
> Thanks for the patch, and sorry for the delay in replying.

How come that you are replying in the first place?  Some weeks ago I've
set my patch to "Superseeded" state at patchwork.

> I couldn't apply the patch against latest git HEAD -- would you mind
> rebasing and resubmit it?  If you don't have time right now no problem
> at all -- Julien and I are working on a bigger agenda change and I'd
> rather apply your patch after his...

Julien already changed parts of the range agenda display, and he told me
that he's planning a bunch of other agenda improvements, where anything
my patch did is also on his todo list, probably in a better, more
general way.  I've heard something like an `org-agenda-line-format'...

So we can forget my patch.

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Properly format start and end times in time ranges.
  2011-02-13 10:08         ` Tassilo Horn
@ 2011-02-13 10:33           ` Bastien
  2011-02-13 11:16             ` Tassilo Horn
  0 siblings, 1 reply; 11+ messages in thread
From: Bastien @ 2011-02-13 10:33 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-orgmode

Hi Tassilo,

Tassilo Horn <tassilo@member.fsf.org> writes:

> How come that you are replying in the first place?  Some weeks ago I've
> set my patch to "Superseeded" state at patchwork.

Well, I thought your patch didn't make its way through patchwork since I
didn't saw it there -- should have searched more carefully.  How can you
set it as Superseeded by yourself?  I don't see your name in the list of
maintainers on patchwork.

>> I couldn't apply the patch against latest git HEAD -- would you mind
>> rebasing and resubmit it?  If you don't have time right now no problem
>> at all -- Julien and I are working on a bigger agenda change and I'd
>> rather apply your patch after his...
>
> Julien already changed parts of the range agenda display, and he told me
> that he's planning a bunch of other agenda improvements, where anything
> my patch did is also on his todo list, probably in a better, more
> general way.  

Yes, probably -- apparently Julien didn't sent his reply to the list,
that's why I thought your patch was waiting for a ACK.

> I've heard something like an `org-agenda-line-format'...

Check it out:

  http://git.naquadah.org/?p=~jd/org-mode.git;a=summary

Test this branch: 

  http://git.naquadah.org/?p=~jd/org-mode.git;a=shortlog;h=refs/heads/jd/agenda-format

> So we can forget my patch.

Okay, thanks for the update.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Properly format start and end times in time ranges.
  2011-02-13 10:33           ` Bastien
@ 2011-02-13 11:16             ` Tassilo Horn
  2011-02-13 13:43               ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Tassilo Horn @ 2011-02-13 11:16 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bastien.guerry@wikimedia.fr> writes:

Hi Bastien,

>> How come that you are replying in the first place?  Some weeks ago
>> I've set my patch to "Superseeded" state at patchwork.
>
> Well, I thought your patch didn't make its way through patchwork since
> I didn't saw it there -- should have searched more carefully.  How can
> you set it as Superseeded by yourself?  I don't see your name in the
> list of maintainers on patchwork.

No, I'm no maintainer.  But I think a contributor may make state changes
to his own patches.

>> I've heard something like an `org-agenda-line-format'...
>
> Check it out:
>
>   http://git.naquadah.org/?p=~jd/org-mode.git;a=summary
>
> Test this branch: 
>
>   http://git.naquadah.org/?p=~jd/org-mode.git;a=shortlog;h=refs/heads/jd/agenda-format

I'll have a look at it!

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Properly format start and end times in time ranges.
  2011-02-13 11:16             ` Tassilo Horn
@ 2011-02-13 13:43               ` Bastien
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2011-02-13 13:43 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-orgmode

Hi Tassilo,

Tassilo Horn <tassilo@member.fsf.org> writes:

> No, I'm no maintainer.  But I think a contributor may make state
> changes to his own patches.

I don't think so, but I would be glad to be wrong!  

If so, we need to document this on Worg/org-contribute.org.

>> Test this branch: 
>>
>>   http://git.naquadah.org/?p=~jd/org-mode.git;a=shortlog;h=refs/heads/jd/agenda-format
>
> I'll have a look at it!

Great, thanks.  The branch really deserves some testing and
debugging...  

All best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-02-13 13:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-05 12:58 Display of time/date ranges in the agenda Tassilo Horn
2011-01-05 16:46 ` Michael Brand
2011-01-05 17:15 ` Memnon Anon
2011-01-06  0:50   ` suvayu ali
2011-01-06 13:18   ` Tassilo Horn
2011-01-06 20:46     ` [PATCH] Properly format start and end times in time ranges. (was: Display of time/date ranges in the agenda) Tassilo Horn
2011-02-13  0:40       ` [PATCH] Properly format start and end times in time ranges Bastien
2011-02-13 10:08         ` Tassilo Horn
2011-02-13 10:33           ` Bastien
2011-02-13 11:16             ` Tassilo Horn
2011-02-13 13:43               ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).