From: Fabio Natali <me@fabionatali.com>
To: help-gnu-emacs@gnu.org
Subject: A couple of questions re 'org-icalendar-export-to-ics'
Date: Sat, 26 Oct 2024 13:58:41 +0100 [thread overview]
Message-ID: <87o737kola.fsf@fabionatali.com> (raw)
Hi,
This is to ask about 'org-icalendar-export-to-ics' and the way it can be
used to export events from a particular Org subtree.
Consider the following Org file:
--8<---------------cut here---------------start------------->8---
* Invites
** Call with Alice
<2024-10-26 Sat 12:00>
To discuss foo.
** Call with Bob
<2024-10-26 Sat 12:00>
To discuss bar.
--8<---------------cut here---------------end--------------->8---
I'd like to send separate invites to Alice and Bob, for the respective
calls with them. I see that 'org-icalendar-export-to-ics' supports an
optional 'SUBTREEP' argument that should limit the export to the Org
subtree at point, for example Alice's invite.
The docstring for 'org-icalendar-export-to-ics' says:
> When optional argument SUBTREEP is non-nil, export the sub-tree at
> point, extracting information from the headline properties first.
However, if I run '(org-icalendar-export-to-ics nil t)' with Alice's
invite at point, I get the following:
--8<---------------cut here---------------start------------->8---
BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:gtd
PRODID:-//User//Emacs with Org mode//EN
X-WR-TIMEZONE:Europe/London
X-WR-CALDESC:Call with Alice
CALSCALE:GREGORIAN
END:VCALENDAR
--8<---------------cut here---------------end--------------->8---
Unexpectedly, the event's time (Sat 2024-10-26) and description ("To
discuss foo.") are gone, they're not in the export.
However the following function works as expected:
--8<---------------cut here---------------start------------->8---
(defun my/org-icalendar-export-to-ics ()
"Export the subtree at point as an iCalendar file."
(interactive)
(save-excursion
(save-restriction
(org-narrow-to-subtree)
(org-icalendar-export-to-ics))))
--8<---------------cut here---------------end--------------->8---
Which returns this file:
--8<---------------cut here---------------start------------->8---
BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:gtd
PRODID:-//User//Emacs with Org mode//EN
X-WR-TIMEZONE:Europe/London
X-WR-CALDESC:
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20241026T115928Z
UID:TS1-fbf4c1ae-884e-46e6-ad0c-adbc73c517ae
DTSTART:20241026T120000
DTEND:20241026T140000
SUMMARY:Call with Alice
DESCRIPTION:<2024-10-26 Sat 12:00> To discuss foo.
CATEGORIES:gtd
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Call with Alice
TRIGGER:-P0DT0H15M0S
END:VALARM
END:VEVENT
END:VCALENDAR
--8<---------------cut here---------------end--------------->8---
Separately and less important, there's a couple of other things that I'm
not sure about re 'org-icalendar-export-to-ics'.
First, the iCal description field is a little awkward:
'DESCRIPTION:<2024-10-26 Sat 12:00> To discuss foo.' It'd be nice to
have the date field stripped and just see 'DESCRIPTION:To discuss foo.',
although I realise this might be difficult and error prone unless the
date field is decorated with a tag of some sort in the original Org
Agenda file.
Second, the description field is repeated twice (see above), although
this might be for the way the iCalendar format works and it might be ok?
Finally, when applied to a subtree or a region, the function will add
UUID fields to all nodes in the Org file. My expectation would have been
that only the selected node would get "UUIDed". For instance, the above
file becomes:
--8<---------------cut here---------------start------------->8---
* Invites
:PROPERTIES:
:ID: 9583c174-6a33-49d5-848e-3fb04ce5e800
:END:
** Call with Alice
:PROPERTIES:
:ID: fbf4c1ae-884e-46e6-ad0c-adbc73c517ae
:END:
<2024-10-26 Sat 12:00>
To discuss foo.
** Call with Bob
:PROPERTIES:
:ID: a1212644-f02d-4231-8a38-b68be8f1d77c
:END:
<2024-10-26 Sat 12:00>
To discuss bar.
--8<---------------cut here---------------end--------------->8---
For context, this is the workflow that I'd like to implement:
- create a new event of type invite via Org Capture,
- the invite gets saved to one of the files monitored by Org Agenda,
- when (successfully) exiting Org Capture a message-mode buffer gets
created, prepoluated with the iCalendar attachment for the invite.
I think 'org-icalendar-export-to-ics' would come in handy and I'd like
to get your thoughts on the behaviour mentioned above.
Thanks, cheers, Fabio.
PS: Kindly CC me if replying to this email.
--
Fabio Natali
https://fabionatali.com
reply other threads:[~2024-10-26 12:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o737kola.fsf@fabionatali.com \
--to=me@fabionatali.com \
--cc=help-gnu-emacs@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.