* icalendar: exporting times of day specified in heading?
@ 2010-01-16 14:38 Stephen Eglen
2010-01-28 14:17 ` Carsten Dominik
2010-02-02 13:16 ` Stephen Eglen
0 siblings, 2 replies; 22+ messages in thread
From: Stephen Eglen @ 2010-01-16 14:38 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Stephen Eglen
Hi,
I often use org-agenda-diary-entry to make simple entries into
an agenda.org file. I see that the agenda is clever enough to recognise
if a time range has been typed into the heading. However, this time
range is not exported by the icalendar code.
Here's a simple example, independent of org-agenda-diary-entry, although
in reality, example 2 would be the type of entry I normally make.
if I have a test.org file containing:
----------------------------------------------------------------------
* <2010-01-16 Sat 08:00-08:30> example 1
* <2010-01-16 Sat> example 2 09:00-09:30
----------------------------------------------------------------------
then when I view the agenda I see:
Saturday 16 January 2010
test: 8:00- 8:30 example 1
8:00...... ----------------
test: 9:00- 9:30 example 2
10:00...... ----------------
[There's an extra space before 'example 2', which I'm not sure about.]
So far, so good - the agenda has parsed 09:00-09:30 from the headline.
But now if I make an ics file (e.g. by 'C-c C-e i' in test.org) the
start and end time of the event are not recognised. Here's a relevant
snippet from test.ics:
BEGIN:VCALENDAR
...
DTSTART:20100116T080000
DTEND:20100116T083000
SUMMARY: example 1
CATEGORIES:test
...
DTSTART;VALUE=DATE:20100116
DTEND;VALUE=DATE:20100117
SUMMARY: example 2 09:00-09:30
What I *think* I'd like is that for the 2nd calendar entry is
DTSTART:20100116T0900
DTEND:20100116T0930
Is that sensible/possible? Alternatively, how about
org-agenda-diary-entry parsing the time specification and writing the
date and time within angle brackets?
(org-version)
"Org-mode version 6.33trans (release_6.33f.22.gcb8ce.dirty)"
Thanks, Stephen
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-16 14:38 icalendar: exporting times of day specified in heading? Stephen Eglen
@ 2010-01-28 14:17 ` Carsten Dominik
2010-01-28 15:22 ` Stephen Eglen
2010-02-02 13:16 ` Stephen Eglen
1 sibling, 1 reply; 22+ messages in thread
From: Carsten Dominik @ 2010-01-28 14:17 UTC (permalink / raw)
To: Stephen Eglen; +Cc: emacs-orgmode
Hi Stephen,
while it might be possible to do what you ask for, I think it is error-
prone because people might accidently have something in the headline
which looks like a time. I don't mind so much if Org's agenda
stumbles over this, but I don't want to produce incorrect icalendar
files.
Also, this icalendar export function is programmed in a messy way, and
I don't see a quick way to fix this.
If you can make me a patch, I will take it.
- Carsten
On Jan 16, 2010, at 3:38 PM, Stephen Eglen wrote:
> Hi,
>
> I often use org-agenda-diary-entry to make simple entries into
> an agenda.org file. I see that the agenda is clever enough to
> recognise
> if a time range has been typed into the heading. However, this time
> range is not exported by the icalendar code.
>
> Here's a simple example, independent of org-agenda-diary-entry,
> although
> in reality, example 2 would be the type of entry I normally make.
>
> if I have a test.org file containing:
> ----------------------------------------------------------------------
> * <2010-01-16 Sat 08:00-08:30> example 1
>
> * <2010-01-16 Sat> example 2 09:00-09:30
> ----------------------------------------------------------------------
>
> then when I view the agenda I see:
>
> Saturday 16 January 2010
> test: 8:00- 8:30 example 1
> 8:00...... ----------------
> test: 9:00- 9:30 example 2
> 10:00...... ----------------
>
> [There's an extra space before 'example 2', which I'm not sure about.]
>
> So far, so good - the agenda has parsed 09:00-09:30 from the headline.
> But now if I make an ics file (e.g. by 'C-c C-e i' in test.org) the
> start and end time of the event are not recognised. Here's a relevant
> snippet from test.ics:
>
> BEGIN:VCALENDAR
> ...
> DTSTART:20100116T080000
> DTEND:20100116T083000
> SUMMARY: example 1
> CATEGORIES:test
> ...
> DTSTART;VALUE=DATE:20100116
> DTEND;VALUE=DATE:20100117
> SUMMARY: example 2 09:00-09:30
>
> What I *think* I'd like is that for the 2nd calendar entry is
>
> DTSTART:20100116T0900
> DTEND:20100116T0930
>
> Is that sensible/possible? Alternatively, how about
> org-agenda-diary-entry parsing the time specification and writing the
> date and time within angle brackets?
>
> (org-version)
> "Org-mode version 6.33trans (release_6.33f.22.gcb8ce.dirty)"
>
> Thanks, Stephen
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-28 14:17 ` Carsten Dominik
@ 2010-01-28 15:22 ` Stephen Eglen
2010-01-28 16:03 ` Eric S Fraga
2010-01-28 18:31 ` Carsten Dominik
0 siblings, 2 replies; 22+ messages in thread
From: Stephen Eglen @ 2010-01-28 15:22 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, Stephen Eglen
Hi Carsten,
> Hi Stephen,
>
> while it might be possible to do what you ask for, I think it is
> error- prone because people might accidently have something in the
> headline which looks like a time. I don't mind so much if Org's
> agenda stumbles over this, but I don't want to produce incorrect
> icalendar files.
>
> Also, this icalendar export function is programmed in a messy way, and
> I don't see a quick way to fix this.
>
> If you can make me a patch, I will take it.
Thanks for this. I did decide to bite the bullet and look into this. I
think I have some working code, modifiying:
org-agenda-add-entry-to-org-agenda-diary-file
so that it parses out the date at that point, conditional on
org-agenda-search-headline-for-time being t. In this way, it doesn't
touch the ical export functions.
I will double check and submit a patch for consideration.
A small note though: along the way, I've sometimes noticed that diary
entries are included with a level 2 heading rather than a level 4
heading. I haven't been able to track this down, its just noticeable
when I later browse agenda.org
*** 2010-02-02 Tuesday
**** 15:00-15:30 check me
<2010-02-02 Tue>
i.e. that 2nd line is sometimes given two heaings, and is not within the
right level 3 heading. Anything obvious I might want to look at when
debugging?
Stephen
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-28 15:22 ` Stephen Eglen
@ 2010-01-28 16:03 ` Eric S Fraga
2010-01-28 18:31 ` Carsten Dominik
1 sibling, 0 replies; 22+ messages in thread
From: Eric S Fraga @ 2010-01-28 16:03 UTC (permalink / raw)
To: Stephen Eglen; +Cc: emacs-orgmode, Carsten Dominik
At Thu, 28 Jan 2010 15:22:41 +0000,
Stephen Eglen wrote:
[...]
> A small note though: along the way, I've sometimes noticed that diary
> entries are included with a level 2 heading rather than a level 4
> heading. I haven't been able to track this down, its just noticeable
> when I later browse agenda.org
> i.e. that 2nd line is sometimes given two heaings, and is not within the
> right level 3 heading.
I also have experienced this, specifically that the actual day entry
does not appear below the month headline but alongside it (i.e. a
sibling, at the same depth). I have not mentioned it before as I
have not been able to have this happen in a reproducible manner.
Also, I'm not sure if it has something to do with the differences
between emacs v23 and v22; I have to use both depending on which of my
computers I happen to have at hand!
[...]
> Anything obvious I might want to look at when
> debugging?
Ditto. If there's any obvious debugging I can do to help track this
down, please let me know. Having said this, I've not noticed it
happen in the past couple of weeks.
eric
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-28 15:22 ` Stephen Eglen
2010-01-28 16:03 ` Eric S Fraga
@ 2010-01-28 18:31 ` Carsten Dominik
2010-01-29 13:04 ` Eric S Fraga
` (2 more replies)
1 sibling, 3 replies; 22+ messages in thread
From: Carsten Dominik @ 2010-01-28 18:31 UTC (permalink / raw)
To: Stephen Eglen; +Cc: emacs-orgmode
On Jan 28, 2010, at 4:22 PM, Stephen Eglen wrote:
> Hi Carsten,
>
>> Hi Stephen,
>>
>> while it might be possible to do what you ask for, I think it is
>> error- prone because people might accidently have something in the
>> headline which looks like a time. I don't mind so much if Org's
>> agenda stumbles over this, but I don't want to produce incorrect
>> icalendar files.
>>
>> Also, this icalendar export function is programmed in a messy way,
>> and
>> I don't see a quick way to fix this.
>>
>> If you can make me a patch, I will take it.
>
> Thanks for this. I did decide to bite the bullet and look into
> this. I
> think I have some working code, modifiying:
> org-agenda-add-entry-to-org-agenda-diary-file
>
> so that it parses out the date at that point, conditional on
> org-agenda-search-headline-for-time being t. In this way, it doesn't
> touch the ical export functions.
>
> I will double check and submit a patch for consideration.
Thanks!
>
> A small note though: along the way, I've sometimes noticed that diary
> entries are included with a level 2 heading rather than a level 4
> heading.
I do not understand this. Included where? How? Can you please
describe this
more extensively?
Thanks
- Carsten
> I haven't been able to track this down, its just noticeable
> when I later browse agenda.org
>
> *** 2010-02-02 Tuesday
> **** 15:00-15:30 check me
> <2010-02-02 Tue>
>
> i.e. that 2nd line is sometimes given two heaings, and is not within
> the
> right level 3 heading. Anything obvious I might want to look at when
> debugging?
>
> Stephen
- Carsten
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-28 18:31 ` Carsten Dominik
@ 2010-01-29 13:04 ` Eric S Fraga
2010-01-29 13:10 ` Stephen Eglen
2010-02-01 12:41 ` Stephen Eglen
2 siblings, 0 replies; 22+ messages in thread
From: Eric S Fraga @ 2010-01-29 13:04 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, Stephen Eglen
At Thu, 28 Jan 2010 19:31:06 +0100,
Carsten Dominik wrote:
>
>
> On Jan 28, 2010, at 4:22 PM, Stephen Eglen wrote:
[...]
> > A small note though: along the way, I've sometimes noticed that diary
> > entries are included with a level 2 heading rather than a level 4
> > heading.
>
> I do not understand this. Included where? How? Can you please
> describe this
> more extensively?
>
> Thanks
Carsten,
I don't know for sure whether what Stephen reports is the same as I
have seen, but what I sometimes get using the 'i d' key sequence in
the agenda (org-agenda-diary-entry) looks like this:
--8<---------------cut here---------------start------------->8---
* 2010
*** 2010-01 January
***** 2010-01-01 Friday
******* something on Friday
<2010-01-01 Fri>
******* something else
<2010-01-01 Fri>
***** 2010-01-06 Wednesday
******* another entry
<2010-01-07 Thu>
*** 2010-01-08 Friday
***** a strangely placed entry
<2010-01-08 Fri>
--8<---------------cut here---------------end--------------->8---
Note the level at which the last entry has been placed: it's a sibling
of the month headline instead of being a child. It's easily fixed
manually but obviously it's best if this doesn't happen!
*But*, please note that I haven't experienced this behaviour during
the past few weeks so it may have been fixed accidentally along the
way... In any case, I've not done any extensive exploration of when
this actually happens and it's not a big deal!
Thanks,
eric
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-28 18:31 ` Carsten Dominik
2010-01-29 13:04 ` Eric S Fraga
@ 2010-01-29 13:10 ` Stephen Eglen
2010-02-01 12:41 ` Stephen Eglen
2 siblings, 0 replies; 22+ messages in thread
From: Stephen Eglen @ 2010-01-29 13:10 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, Stephen Eglen
> > A small note though: along the way, I've sometimes noticed that diary
> > entries are included with a level 2 heading rather than a level 4
> > heading.
>
> I do not understand this. Included where? How? Can you please
> describe this
> more extensively?
From the *Org Agenda* buffer, if I visit the 6 Feb 2010, and then do
'i d' 'test weekend', what I expect to see in the agenda.org file is
>>
*** 2010-02-06 Saturday
**** test weekend
<2010-02-06 Sat>
<<
whereas what I got was:
>>
*** 2010-02-06 Saturday
** test weekend
<2010-02-06 Sat>
<<
this level-3 heading sits under
** 2010-02 February
which in turn is under
* 2010
This is not easy to reproduce, and it took me a few tries to get this
one. But I think I've got it to the stage where I at least get
reproduce it with a fresh emacs (v23) run on my current agenda.org file.
Stephen
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-28 18:31 ` Carsten Dominik
2010-01-29 13:04 ` Eric S Fraga
2010-01-29 13:10 ` Stephen Eglen
@ 2010-02-01 12:41 ` Stephen Eglen
2010-02-01 13:31 ` Carsten Dominik
2 siblings, 1 reply; 22+ messages in thread
From: Stephen Eglen @ 2010-02-01 12:41 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, Eric S Fraga, Stephen Eglen
Here is a shorter example of the bug of adding new items to
org-agenda-diary-file using 'i d' from the *Org Agenda* buffer.
(setq org-agenda-diary-file "~/txt/org/a.org")
Start with an small agenda.org file (a.org) containing
----------------------------------------------------------------------
* 2010
** 2010-03 March
*** 2010-03-02 Tuesday
**** test 1
<2010-03-02 Tue>
*** 2010-03-06 Saturday
**** test 2
<2010-03-06 Sat>
----------------------------------------------------------------------
(those entries were put in using 'i d' fine).
Go into a.org and show only the top-level heading is shown, i.e.
* 2010...
Everything else is hidden. Now go back to the agenda and e.g. on the
3rd March add a diary entry 'i d test 3'. What I then see in a.org is:
----------------------------------------------------------------------
* 2010
** 2010-03 March
*** 2010-03-02 Tuesday
**** test 1
<2010-03-02 Tue>
*** 2010-03-03 Wednesday
** test 3
<2010-03-03 Wed>
*** 2010-03-06 Saturday
**** test 2
<2010-03-06 Sat>
----------------------------------------------------------------------
test 3 is incorrectly given a level 2 heading, and there are two lines
of whitespace before the level-3 date heading.
If however the whole date tree is visible before doing the 'i d'
command, I get the correct output:
----------------------------------------------------------------------
* 2010
** 2010-03 March
*** 2010-03-02 Tuesday
**** test 1
<2010-03-02 Tue>
*** 2010-03-03 Wednesday
**** test 3
<2010-03-03 Wed>
*** 2010-03-06 Saturday
**** test 2
<2010-03-06 Sat>
----------------------------------------------------------------------
(emacs-version)
"GNU Emacs 23.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.16.1)
of 2009-08-05 on maps"
(org-version)
"Org-mode version 6.34trans (release_6.34c.25.g3693.dirty)"
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-02-01 12:41 ` Stephen Eglen
@ 2010-02-01 13:31 ` Carsten Dominik
2010-02-01 13:49 ` Eric S Fraga
2010-02-01 14:00 ` Stephen Eglen
0 siblings, 2 replies; 22+ messages in thread
From: Carsten Dominik @ 2010-02-01 13:31 UTC (permalink / raw)
To: Stephen Eglen; +Cc: Eric S Fraga, emacs-orgmode
Hi Stephen, Eric,
this bug should be fixed now.
Thanks!
- Carsten
On Feb 1, 2010, at 1:41 PM, Stephen Eglen wrote:
> Here is a shorter example of the bug of adding new items to
> org-agenda-diary-file using 'i d' from the *Org Agenda* buffer.
>
> (setq org-agenda-diary-file "~/txt/org/a.org")
>
> Start with an small agenda.org file (a.org) containing
> ----------------------------------------------------------------------
> * 2010
> ** 2010-03 March
> *** 2010-03-02 Tuesday
> **** test 1
> <2010-03-02 Tue>
> *** 2010-03-06 Saturday
> **** test 2
> <2010-03-06 Sat>
> ----------------------------------------------------------------------
>
> (those entries were put in using 'i d' fine).
>
> Go into a.org and show only the top-level heading is shown, i.e.
>
> * 2010...
>
> Everything else is hidden. Now go back to the agenda and e.g. on the
> 3rd March add a diary entry 'i d test 3'. What I then see in a.org
> is:
>
> ----------------------------------------------------------------------
> * 2010
> ** 2010-03 March
> *** 2010-03-02 Tuesday
> **** test 1
> <2010-03-02 Tue>
> *** 2010-03-03 Wednesday
>
>
> ** test 3
> <2010-03-03 Wed>
> *** 2010-03-06 Saturday
> **** test 2
> <2010-03-06 Sat>
> ----------------------------------------------------------------------
>
> test 3 is incorrectly given a level 2 heading, and there are two lines
> of whitespace before the level-3 date heading.
>
> If however the whole date tree is visible before doing the 'i d'
> command, I get the correct output:
>
> ----------------------------------------------------------------------
> * 2010
> ** 2010-03 March
> *** 2010-03-02 Tuesday
> **** test 1
> <2010-03-02 Tue>
> *** 2010-03-03 Wednesday
> **** test 3
> <2010-03-03 Wed>
> *** 2010-03-06 Saturday
> **** test 2
> <2010-03-06 Sat>
> ----------------------------------------------------------------------
>
> (emacs-version)
> "GNU Emacs 23.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.16.1)
> of 2009-08-05 on maps"
>
> (org-version)
> "Org-mode version 6.34trans (release_6.34c.25.g3693.dirty)"
- Carsten
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-02-01 13:31 ` Carsten Dominik
@ 2010-02-01 13:49 ` Eric S Fraga
2010-02-01 14:00 ` Stephen Eglen
1 sibling, 0 replies; 22+ messages in thread
From: Eric S Fraga @ 2010-02-01 13:49 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, Stephen Eglen
At Mon, 1 Feb 2010 14:31:02 +0100,
Carsten Dominik wrote:
>
> Hi Stephen, Eric,
>
> this bug should be fixed now.
Thanks!
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-02-01 13:31 ` Carsten Dominik
2010-02-01 13:49 ` Eric S Fraga
@ 2010-02-01 14:00 ` Stephen Eglen
2010-02-01 14:08 ` Stephen Eglen
1 sibling, 1 reply; 22+ messages in thread
From: Stephen Eglen @ 2010-02-01 14:00 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, Eric S Fraga, Stephen Eglen
Thanks Carsten,
the test case I sent before now works properly in terms of indentation:
----------------------------------------------------------------------
* 2010
** 2010-03 March
*** 2010-03-02 Tuesday
**** test 1
<2010-03-02 Tue>
*** 2010-03-03 Wednesday
**** test 3
<2010-03-03 Wed>
*** 2010-03-06 Saturday
**** test 2
<2010-03-06 Sat>
----------------------------------------------------------------------
There's still something putting in an extra blank line though (see empty
line before 'test 3' heading. This blank line is not added if the tree
is visible before doing 'i d'.
Stephen
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-01-16 14:38 icalendar: exporting times of day specified in heading? Stephen Eglen
2010-01-28 14:17 ` Carsten Dominik
@ 2010-02-02 13:16 ` Stephen Eglen
2010-02-03 15:25 ` Carsten Dominik
2010-03-17 13:26 ` Matt Lundin
1 sibling, 2 replies; 22+ messages in thread
From: Stephen Eglen @ 2010-02-02 13:16 UTC (permalink / raw)
To: Stephen Eglen; +Cc: emacs-orgmode
>
> I often use org-agenda-diary-entry to make simple entries into
> an agenda.org file. I see that the agenda is clever enough to recognise
> if a time range has been typed into the heading. However, this time
> range is not exported by the icalendar code.
Attached is a patch to the code underlying 'i d' entries in the *Org
Agenda* buffer. If a time of day is specified in the entry, it is
extracted from the entry and put into the timestamp of the diary entry.
(The .ics exporting code recognises these timestamps and therefore the
ics export code does not need altering.)
For example, given the following three entries added using 'i d' from
*Org Agenda*:
i d RET test 1 12:00-14:00 classes RET
i d RET test 2 did you get 7am wake up call? RET
i d RET test 3 find 3--5 volunteers RET
then the following entries are added to agenda.org:
*** 2010-02-03 Wednesday
**** test 3 find 3--5 volunteers
<2010-02-03 Wed>
**** test 2 did you get wake up call?
<2010-02-03 Wed 07:00>
**** test 1 classes
<2010-02-03 Wed 12:00-14:00>
As this behvaiour may not be desired by all, I've currently put the code
conditional on org-agenda-search-headline-for-time being non-nil (the
default is t). If that variable is nil, then the above three test
entries generates the regular tree:
*** 2010-02-03 Wednesday
**** test 3 find 3--5 volunteers
<2010-02-03 Wed>
**** test 2 did you get 7am wake up call?
<2010-02-03 Wed>
**** test 1 12:00-14:00 classes
<2010-02-03 Wed>
Perhaps org-agenda-search-headline-for-time is not the right variable
though (happy to had another) given that it defaults to t?
Stephen
2010-02-02 Stephen Eglen <stephen@gnu.org>
* org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
Optionally extract time specification from text and add to the
timestamp.
*** /tmp/ediff11782joC 2010-02-02 13:07:49.000000000 +0000
--- /home/stephen/langs/emacs/elisp-ds/org-mode/lisp/org-agenda.el 2010-02-02 09:48:10.000000000 +0000
***************
*** 6891,6903 ****
(insert (format "%%%%(diary-anniversary %s) %s"
(calendar-date-string d1 nil t) text))))
((eq type 'day)
! (if (eq org-agenda-insert-diary-strategy 'top-level)
! (org-agenda-insert-diary-as-top-level text)
! (require 'org-datetree)
! (org-datetree-find-date-create d1)
! (org-agenda-insert-diary-make-new-entry text))
! (org-insert-time-stamp (org-time-from-absolute
! (calendar-absolute-from-gregorian d1)))
(end-of-line 0))
((eq type 'block)
(if (> (calendar-absolute-from-gregorian d1)
--- 6891,6919 ----
(insert (format "%%%%(diary-anniversary %s) %s"
(calendar-date-string d1 nil t) text))))
((eq type 'day)
! (let*
! (fmt time time2
! (org-agenda-time-leading-zero t))
! (if org-agenda-search-headline-for-time
! ;; Use org-format-agenda-item to parse text for a time-range and
! ;; remove it.
! (setq fmt (org-format-agenda-item nil text nil nil t)
! time (get-text-property 0 'time fmt)
! time2 (if (> (length time) 0)
! ;; split-string removes trailing ...... if
! ;; no end time given. First space
! ;; separates time from date.
! (concat " " (car (split-string time "\\.")))
! nil)
! text (get-text-property 0 'txt fmt)))
! (if (eq org-agenda-insert-diary-strategy 'top-level)
! (org-agenda-insert-diary-as-top-level text)
! (require 'org-datetree)
! (org-datetree-find-date-create d1)
! (org-agenda-insert-diary-make-new-entry text))
! (org-insert-time-stamp (org-time-from-absolute
! (calendar-absolute-from-gregorian d1))
! nil nil nil nil time2))
(end-of-line 0))
((eq type 'block)
(if (> (calendar-absolute-from-gregorian d1)
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Re: icalendar: exporting times of day specified in heading?
2010-02-02 13:16 ` Stephen Eglen
@ 2010-02-03 15:25 ` Carsten Dominik
2010-03-17 13:26 ` Matt Lundin
1 sibling, 0 replies; 22+ messages in thread
From: Carsten Dominik @ 2010-02-03 15:25 UTC (permalink / raw)
To: Stephen Eglen; +Cc: emacs-orgmode
Hi Stephen,
this is an interesting patch. I am a bit uneasy because
it changes the entered text and that may work better in
some cases than in others. However, as the resulting agenda
entry is the same, I have applied the patch. We'll see how
it goes - maybe we do need to add another variable for this
eventually.
Thanks!
- Carsten
On Feb 2, 2010, at 2:16 PM, Stephen Eglen wrote:
>>
>> I often use org-agenda-diary-entry to make simple entries into
>> an agenda.org file. I see that the agenda is clever enough to
>> recognise
>> if a time range has been typed into the heading. However, this time
>> range is not exported by the icalendar code.
>
> Attached is a patch to the code underlying 'i d' entries in the *Org
> Agenda* buffer. If a time of day is specified in the entry, it is
> extracted from the entry and put into the timestamp of the diary
> entry.
> (The .ics exporting code recognises these timestamps and therefore the
> ics export code does not need altering.)
>
> For example, given the following three entries added using 'i d' from
> *Org Agenda*:
>
> i d RET test 1 12:00-14:00 classes RET
> i d RET test 2 did you get 7am wake up call? RET
> i d RET test 3 find 3--5 volunteers RET
>
> then the following entries are added to agenda.org:
>
> *** 2010-02-03 Wednesday
>
> **** test 3 find 3--5 volunteers
> <2010-02-03 Wed>
> **** test 2 did you get wake up call?
> <2010-02-03 Wed 07:00>
> **** test 1 classes
> <2010-02-03 Wed 12:00-14:00>
>
> As this behvaiour may not be desired by all, I've currently put the
> code
> conditional on org-agenda-search-headline-for-time being non-nil (the
> default is t). If that variable is nil, then the above three test
> entries generates the regular tree:
>
> *** 2010-02-03 Wednesday
>
> **** test 3 find 3--5 volunteers
> <2010-02-03 Wed>
> **** test 2 did you get 7am wake up call?
> <2010-02-03 Wed>
> **** test 1 12:00-14:00 classes
> <2010-02-03 Wed>
>
>
> Perhaps org-agenda-search-headline-for-time is not the right variable
> though (happy to had another) given that it defaults to t?
>
> Stephen
>
> 2010-02-02 Stephen Eglen <stephen@gnu.org>
>
> * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
> Optionally extract time specification from text and add to the
> timestamp.
>
> *** /tmp/ediff11782joC 2010-02-02 13:07:49.000000000 +0000
> --- /home/stephen/langs/emacs/elisp-ds/org-mode/lisp/org-agenda.el
> 2010-02-02 09:48:10.000000000 +0000
> ***************
> *** 6891,6903 ****
> (insert (format "%%%%(diary-anniversary %s) %s"
> (calendar-date-string d1 nil t) text))))
> ((eq type 'day)
> ! (if (eq org-agenda-insert-diary-strategy 'top-level)
> ! (org-agenda-insert-diary-as-top-level text)
> ! (require 'org-datetree)
> ! (org-datetree-find-date-create d1)
> ! (org-agenda-insert-diary-make-new-entry text))
> ! (org-insert-time-stamp (org-time-from-absolute
> ! (calendar-absolute-from-gregorian d1)))
> (end-of-line 0))
> ((eq type 'block)
> (if (> (calendar-absolute-from-gregorian d1)
> --- 6891,6919 ----
> (insert (format "%%%%(diary-anniversary %s) %s"
> (calendar-date-string d1 nil t) text))))
> ((eq type 'day)
> ! (let*
> ! (fmt time time2
> ! (org-agenda-time-leading-zero t))
> ! (if org-agenda-search-headline-for-time
> ! ;; Use org-format-agenda-item to parse text for a time-range
> and
> ! ;; remove it.
> ! (setq fmt (org-format-agenda-item nil text nil nil t)
> ! time (get-text-property 0 'time fmt)
> ! time2 (if (> (length time) 0)
> ! ;; split-string removes trailing ...... if
> ! ;; no end time given. First space
> ! ;; separates time from date.
> ! (concat " " (car (split-string time "\\.")))
> ! nil)
> ! text (get-text-property 0 'txt fmt)))
> ! (if (eq org-agenda-insert-diary-strategy 'top-level)
> ! (org-agenda-insert-diary-as-top-level text)
> ! (require 'org-datetree)
> ! (org-datetree-find-date-create d1)
> ! (org-agenda-insert-diary-make-new-entry text))
> ! (org-insert-time-stamp (org-time-from-absolute
> ! (calendar-absolute-from-gregorian d1))
> ! nil nil nil nil time2))
> (end-of-line 0))
> ((eq type 'block)
> (if (> (calendar-absolute-from-gregorian d1)
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-02-02 13:16 ` Stephen Eglen
2010-02-03 15:25 ` Carsten Dominik
@ 2010-03-17 13:26 ` Matt Lundin
2010-03-17 13:40 ` Stephen Eglen
1 sibling, 1 reply; 22+ messages in thread
From: Matt Lundin @ 2010-03-17 13:26 UTC (permalink / raw)
To: Stephen Eglen; +Cc: emacs-orgmode, Carsten Dominik
Hi Stephen,
Sorry for the late reply, but I've just begun using "i d" to enter dates
into my org files and I have a few comments on the patch you submitted
in February.
Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:
>>
>> I often use org-agenda-diary-entry to make simple entries into
>> an agenda.org file. I see that the agenda is clever enough to recognise
>> if a time range has been typed into the heading. However, this time
>> range is not exported by the icalendar code.
>
> Attached is a patch to the code underlying 'i d' entries in the *Org
> Agenda* buffer. If a time of day is specified in the entry, it is
> extracted from the entry and put into the timestamp of the diary entry.
> (The .ics exporting code recognises these timestamps and therefore the
> ics export code does not need altering.)
>
> For example, given the following three entries added using 'i d' from
> *Org Agenda*:
>
> i d RET test 1 12:00-14:00 classes RET
> i d RET test 2 did you get 7am wake up call? RET
> i d RET test 3 find 3--5 volunteers RET
>
> then the following entries are added to agenda.org:
>
> *** 2010-02-03 Wednesday
>
> **** test 3 find 3--5 volunteers
> <2010-02-03 Wed>
> **** test 2 did you get wake up call?
> <2010-02-03 Wed 07:00>
> **** test 1 classes
> <2010-02-03 Wed 12:00-14:00>
When I enter the time of day after typing "i d", the time of day is
added to the timestamp (as above) but is *not* removed the headline.
E.g.,
--8<---------------cut here---------------start------------->8---
"Day entry: 9:00am go shopping [RET]"
--8<---------------cut here---------------end--------------->8---
...results in the following headline...
--8<---------------cut here---------------start------------->8---
* 9:00am go shopping
<2010-03-17 Wed 09:00>
--8<---------------cut here---------------end--------------->8---
As a consequence, the agenda line duplicates the time of day.
--8<---------------cut here---------------start------------->8---
index: 9:00...... 9:00am go shopping
--8<---------------cut here---------------end--------------->8---
I'd be curious to know whether others can duplicate this bug.
> As this behvaiour may not be desired by all, I've currently put the code
> conditional on org-agenda-search-headline-for-time being non-nil (the
> default is t). If that variable is nil, then the above three test
> entries generates the regular tree:
Might I request an independent variable for this? While I would like the
agenda to scan my headlines for time of day specifications (and thus
have org-agenda-search-headline-for-time set to t), I am not sure I want
org-agenda-add-entry-to-org-agenda-diary-file to alter the information I
enter at the "Day entry: " prompt.
Thanks,
Matt
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-03-17 13:26 ` Matt Lundin
@ 2010-03-17 13:40 ` Stephen Eglen
2010-03-17 15:28 ` Stephen Eglen
2010-03-18 2:17 ` Matthew Lundin
0 siblings, 2 replies; 22+ messages in thread
From: Stephen Eglen @ 2010-03-17 13:40 UTC (permalink / raw)
To: Matt Lundin; +Cc: emacs-orgmode, Stephen Eglen, Carsten Dominik
hi Matt,
> When I enter the time of day after typing "i d", the time of day is
> added to the timestamp (as above) but is *not* removed the headline.
> E.g.,
>
> "Day entry: 9:00am go shopping [RET]"
>
> ...results in the following headline...
>
> * 9:00am go shopping
> <2010-03-17 Wed 09:00>
that's odd; I just tried that and got:
******* go shopping
<2010-03-17 Wed 09:00>
which then shows in the agenda as:
agenda: 9:00...... go shopping
> I'd be curious to know whether others can duplicate this bug.
me too!
Do you get any better behaviour if you just put 9:00 or 09:00? Would be
good to resolve this in case there is a bug lurking elsewhere...
> Might I request an independent variable for this? While I would like the
> agenda to scan my headlines for time of day specifications (and thus
> have org-agenda-search-headline-for-time set to t), I am not sure I want
> org-agenda-add-entry-to-org-agenda-diary-file to alter the information I
> enter at the "Day entry: " prompt.
Certainly I'd be in agreement with that, as I don't want to jump on
others preferences.
Currently, org-agenda.el has (l 7079)
(if org-agenda-search-headline-for-time
to check whether we should extract the time; how about if I replaced it
with a variable called org-agenda-extract-time-from-entry which defaults
to nil so this behaviour is normally off?
Sorry about this Matt.
Stephen
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-03-17 13:40 ` Stephen Eglen
@ 2010-03-17 15:28 ` Stephen Eglen
2010-03-17 15:55 ` Carsten Dominik
2010-03-18 2:17 ` Matthew Lundin
1 sibling, 1 reply; 22+ messages in thread
From: Stephen Eglen @ 2010-03-17 15:28 UTC (permalink / raw)
To: Stephen Eglen; +Cc: Matt Lundin, emacs-orgmode, Carsten Dominik
Ok, here is a patch that introduces a new variable so that the code to
extract times from diary entries entered using 'i d' is off by default.
2010-03-17 Stephen Eglen <stephen@gnu.org>
* org-agenda.el (org-agenda-insert-diary-extract-time): New
variable.
(org-agenda-add-entry-to-org-agenda-diary-file): Use this new
variable rather than org-agenda-search-headline-for-time.
*** /tmp/ediff23195Zk 2010-03-17 15:22:42.000000000 +0000
--- /home/stephen/langs/emacs/elisp-ds/org-mode/lisp/org-agenda.el 2010-03-17 15:20:56.000000000 +0000
***************
*** 7066,7071 ****
--- 7066,7076 ----
(const :tag "in a date tree" date-tree)
(const :tag "as top level at end of file" top-level)))
+ (defcustom org-agenda-insert-diary-extract-time nil
+ "Non-nil means extract any time specification from the diary entry."
+ :group 'org-agenda
+ :type 'boolean)
+
(defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2)
"Add a diary entry with TYPE to `org-agenda-diary-file'.
If TEXT is not empty, it will become the headline of the new entry, and
***************
*** 7103,7109 ****
(let*
(fmt time time2
(org-agenda-time-leading-zero t))
! (if org-agenda-search-headline-for-time
;; Use org-format-agenda-item to parse text for a time-range and
;; remove it.
(setq fmt (org-format-agenda-item nil text nil nil t)
--- 7108,7114 ----
(let*
(fmt time time2
(org-agenda-time-leading-zero t))
! (if org-agenda-insert-diary-extract-time
;; Use org-format-agenda-item to parse text for a time-range and
;; remove it.
(setq fmt (org-format-agenda-item nil text nil nil t)
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-03-17 15:28 ` Stephen Eglen
@ 2010-03-17 15:55 ` Carsten Dominik
2010-03-17 18:51 ` Stephen Eglen
0 siblings, 1 reply; 22+ messages in thread
From: Carsten Dominik @ 2010-03-17 15:55 UTC (permalink / raw)
To: Stephen Eglen; +Cc: Matt Lundin, emacs-orgmode
Applied, thanks.
Stephen, woudl you ming changing your diff format to diff -u ?
Somehow I have problems to apply your patches (already earlier...)
Thanks
- Carsten
On Mar 17, 2010, at 4:28 PM, Stephen Eglen wrote:
> Ok, here is a patch that introduces a new variable so that the code to
> extract times from diary entries entered using 'i d' is off by
> default.
>
> 2010-03-17 Stephen Eglen <stephen@gnu.org>
>
> * org-agenda.el (org-agenda-insert-diary-extract-time): New
> variable.
> (org-agenda-add-entry-to-org-agenda-diary-file): Use this new
> variable rather than org-agenda-search-headline-for-time.
>
> *** /tmp/ediff23195Zk 2010-03-17 15:22:42.000000000 +0000
> --- /home/stephen/langs/emacs/elisp-ds/org-mode/lisp/org-agenda.el
> 2010-03-17 15:20:56.000000000 +0000
> ***************
> *** 7066,7071 ****
> --- 7066,7076 ----
> (const :tag "in a date tree" date-tree)
> (const :tag "as top level at end of file" top-level)))
>
> + (defcustom org-agenda-insert-diary-extract-time nil
> + "Non-nil means extract any time specification from the diary
> entry."
> + :group 'org-agenda
> + :type 'boolean)
> +
> (defun org-agenda-add-entry-to-org-agenda-diary-file (type text
> &optional d1 d2)
> "Add a diary entry with TYPE to `org-agenda-diary-file'.
> If TEXT is not empty, it will become the headline of the new entry,
> and
> ***************
> *** 7103,7109 ****
> (let*
> (fmt time time2
> (org-agenda-time-leading-zero t))
> ! (if org-agenda-search-headline-for-time
> ;; Use org-format-agenda-item to parse text for a time-range and
> ;; remove it.
> (setq fmt (org-format-agenda-item nil text nil nil t)
> --- 7108,7114 ----
> (let*
> (fmt time time2
> (org-agenda-time-leading-zero t))
> ! (if org-agenda-insert-diary-extract-time
> ;; Use org-format-agenda-item to parse text for a time-range and
> ;; remove it.
> (setq fmt (org-format-agenda-item nil text nil nil t)
- Carsten
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-03-17 13:40 ` Stephen Eglen
2010-03-17 15:28 ` Stephen Eglen
@ 2010-03-18 2:17 ` Matthew Lundin
2010-03-18 5:37 ` Carsten Dominik
1 sibling, 1 reply; 22+ messages in thread
From: Matthew Lundin @ 2010-03-18 2:17 UTC (permalink / raw)
To: Stephen Eglen; +Cc: emacs-orgmode, Carsten Dominik
Hi Stephen,
Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:
>> When I enter the time of day after typing "i d", the time of day is
>> added to the timestamp (as above) but is *not* removed the headline.
>> E.g.,
>>
>> "Day entry: 9:00am go shopping [RET]"
>>
>> ...results in the following headline...
>>
>> * 9:00am go shopping
>> <2010-03-17 Wed 09:00>
>
> that's odd; I just tried that and got:
>
> ******* go shopping
> <2010-03-17 Wed 09:00>
> which then shows in the agenda as:
>
> agenda: 9:00...... go shopping
>
>> I'd be curious to know whether others can duplicate this bug.
> me too!
>
> Do you get any better behaviour if you just put 9:00 or 09:00? Would be
> good to resolve this in case there is a bug lurking elsewhere...
I believe I've pinned down the cause of the reported behavior.
My default agenda buffer is a custom agenda block, which consists of an
agenda view and a todo view. The inclusion of the todo view caused the
variable org-prefix-has-time to be set to nil, which in turn prevented
org-format-agenda-item from removing the time of day string from the
headline (see lines 4857-64 of org-agenda.el). Thus, when I called "i d"
from the block agenda, the time was not removed from the headline; when
I called "i d" from the default agenda or the calendar, it was removed.
Here's a patch that ensures the time of day is removed regardless of the
current value of org-prefix-has-time:
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a50a364..9d4a4c4 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7107,6 +7107,7 @@ the resulting entry will not be shown. When TEXT is empty, switch to
((eq type 'day)
(let*
(fmt time time2
+ (org-prefix-has-time t)
(org-agenda-time-leading-zero t))
(if org-agenda-insert-diary-extract-time
;; Use org-format-agenda-item to parse text for a time-range and
--8<---------------cut here---------------end--------------->8---
> Currently, org-agenda.el has (l 7079)
>
> (if org-agenda-search-headline-for-time
>
> to check whether we should extract the time; how about if I replaced it
> with a variable called org-agenda-extract-time-from-entry which defaults
> to nil so this behaviour is normally off?
Many thanks for adding this new variable.
Best,
Matt
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: icalendar: exporting times of day specified in heading?
2010-03-18 2:17 ` Matthew Lundin
@ 2010-03-18 5:37 ` Carsten Dominik
0 siblings, 0 replies; 22+ messages in thread
From: Carsten Dominik @ 2010-03-18 5:37 UTC (permalink / raw)
To: Matthew Lundin; +Cc: emacs-orgmode, Stephen Eglen
Applied, thanks.
- Carsten
On Mar 18, 2010, at 3:17 AM, Matthew Lundin wrote:
> Hi Stephen,
>
> Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:
>
>>> When I enter the time of day after typing "i d", the time of day is
>>> added to the timestamp (as above) but is *not* removed the headline.
>>> E.g.,
>>>
>>> "Day entry: 9:00am go shopping [RET]"
>>>
>>> ...results in the following headline...
>>>
>>> * 9:00am go shopping
>>> <2010-03-17 Wed 09:00>
>>
>> that's odd; I just tried that and got:
>>
>> ******* go shopping
>> <2010-03-17 Wed 09:00>
>> which then shows in the agenda as:
>>
>> agenda: 9:00...... go shopping
>>
>>> I'd be curious to know whether others can duplicate this bug.
>> me too!
>>
>> Do you get any better behaviour if you just put 9:00 or 09:00?
>> Would be
>> good to resolve this in case there is a bug lurking elsewhere...
>
> I believe I've pinned down the cause of the reported behavior.
>
> My default agenda buffer is a custom agenda block, which consists of
> an
> agenda view and a todo view. The inclusion of the todo view caused the
> variable org-prefix-has-time to be set to nil, which in turn prevented
> org-format-agenda-item from removing the time of day string from the
> headline (see lines 4857-64 of org-agenda.el). Thus, when I called
> "i d"
> from the block agenda, the time was not removed from the headline;
> when
> I called "i d" from the default agenda or the calendar, it was
> removed.
>
> Here's a patch that ensures the time of day is removed regardless of
> the
> current value of org-prefix-has-time:
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index a50a364..9d4a4c4 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -7107,6 +7107,7 @@ the resulting entry will not be shown. When
> TEXT is empty, switch to
> ((eq type 'day)
> (let*
> (fmt time time2
> + (org-prefix-has-time t)
> (org-agenda-time-leading-zero t))
> (if org-agenda-insert-diary-extract-time
> ;; Use org-format-agenda-item to parse text for a time-range and
> --8<---------------cut here---------------end--------------->8---
>
>> Currently, org-agenda.el has (l 7079)
>>
>> (if org-agenda-search-headline-for-time
>>
>> to check whether we should extract the time; how about if I
>> replaced it
>> with a variable called org-agenda-extract-time-from-entry which
>> defaults
>> to nil so this behaviour is normally off?
>
> Many thanks for adding this new variable.
>
> Best,
> Matt
- Carsten
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2010-03-18 7:00 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-16 14:38 icalendar: exporting times of day specified in heading? Stephen Eglen
2010-01-28 14:17 ` Carsten Dominik
2010-01-28 15:22 ` Stephen Eglen
2010-01-28 16:03 ` Eric S Fraga
2010-01-28 18:31 ` Carsten Dominik
2010-01-29 13:04 ` Eric S Fraga
2010-01-29 13:10 ` Stephen Eglen
2010-02-01 12:41 ` Stephen Eglen
2010-02-01 13:31 ` Carsten Dominik
2010-02-01 13:49 ` Eric S Fraga
2010-02-01 14:00 ` Stephen Eglen
2010-02-01 14:08 ` Stephen Eglen
2010-02-02 13:16 ` Stephen Eglen
2010-02-03 15:25 ` Carsten Dominik
2010-03-17 13:26 ` Matt Lundin
2010-03-17 13:40 ` Stephen Eglen
2010-03-17 15:28 ` Stephen Eglen
2010-03-17 15:55 ` Carsten Dominik
2010-03-17 18:51 ` Stephen Eglen
[not found] ` <0F399028-B7BE-4C90-AEA7-099AC05E9040@tsdye.com>
2010-03-17 20:15 ` Stephen Eglen
2010-03-18 2:17 ` Matthew Lundin
2010-03-18 5:37 ` Carsten Dominik
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).