emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: icalendar: exporting times of day specified in heading?
Date: Wed, 3 Feb 2010 16:25:18 +0100	[thread overview]
Message-ID: <1EE6AEFC-CD61-44B9-9923-EAB2006570BB@gmail.com> (raw)
In-Reply-To: <11681.1265116614@maps>

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

  reply	other threads:[~2010-02-03 15:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1EE6AEFC-CD61-44B9-9923-EAB2006570BB@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=S.J.Eglen@damtp.cam.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).