From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fabio Natali Newsgroups: gmane.emacs.help Subject: A couple of questions re 'org-icalendar-export-to-ics' Date: Sat, 26 Oct 2024 13:58:41 +0100 Message-ID: <87o737kola.fsf@fabionatali.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6303"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 26 20:11:47 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t4lGM-0001WJ-Gi for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 26 Oct 2024 20:11:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4lFn-0000Nc-33; Sat, 26 Oct 2024 14:11:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4gNU-0006TG-8m for help-gnu-emacs@gnu.org; Sat, 26 Oct 2024 08:58:48 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4gNR-0004ow-Nq for help-gnu-emacs@gnu.org; Sat, 26 Oct 2024 08:58:48 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 20BE320002 for ; Sat, 26 Oct 2024 12:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fabionatali.com; s=gm1; t=1729947522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=OEclbwXAdOov2mFp6xVMjVm98Zt826bFhs2RatpmFI8=; b=dL6AekSqNSnSYEMGZBsK7XVRU4j+LBtCbl8z9O8iC7lnP/HL9hi01Pcu1o3tz4xOoXQt/A 6NOTFimyg5YptwKey4/cny7843J+38YZaZCMNFsb6QNBHn4UdcxdN4Rlj84Rd/TtGIXAvD 66A+/IY0vi8262S6jUn4KFa18HasE9EsvpxW+i28BGWWwzByTegfWmYSxWdQPTTEhesBA+ xHmuRRBqJvgGd3DzPmHJnPJDV11JiIA56TpsS44L4yp5wQwHVXri0fb2885qxq8qN1tPuN /dsD10co4rAZ+PKZksUw07u6tbvGGVKZ4arsXzjgiDoWUsnEJ5Jn5AsQGzNo9w== X-GND-Sasl: me@fabionatali.com Received-SPF: pass client-ip=217.70.183.200; envelope-from=me@fabionatali.com; helo=relay7-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 26 Oct 2024 14:11:08 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148252 Archived-At: 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