unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Lawrence <rwl@recursewithless.net>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Adam Porter <adam@alphapapa.net>, emacs-devel@gnu.org
Subject: Re: Improving Emacs' iCalendar support
Date: Wed, 23 Oct 2024 11:01:26 +0200	[thread overview]
Message-ID: <87bjzbp509.fsf@ohm.mail-host-address-is-not-set> (raw)
In-Reply-To: <87zfmwyoa9.fsf@localhost>

Hi Ihor,

Ihor Radchenko <yantar92@posteo.net> writes:

> Some kind of icalendar parser could be useful.

Great to know you'd be interested in this!

> In Org mode, we currently do icalendar export by hand-writing iCalendar
> entries as strings and need to be careful about things like line endings
> and special symbols.

Yes. 

> What could be done instead is some kind of Elisp API similar to
> `xml-parse-region' and `xml-print', so that things like escaping
> symbols, exact literals, newlines, etc are handled behind the scenes, and
> we could instead just define an AST and "print" it into a valid
> iCalendar file.
>
> So, my suggestion would be something akin xml.el and maybe (optionally)
> https://github.com/ndwarshuis/org-ml - to manipulate the AST.

Thank you, this is a very useful suggestion. I wasn't aware that xml.el
had an API like this -- I will take a look.

At the moment, I am drafting a set of data structures that the parser
will produce, and the printer will consume. Following Adam's suggestion,
I've been basing these on cl-structs (except for simple atomic values). So
eventually you should be able to write code that's something like this:

(icalendar-make-vevent
  ;; properties:
  (list (icalendar-make-property "DTSTART"
           (icalendar-datetime-from-timestamp some-lisp-timestamp))
        (icalendar-make-property "DTEND"
           (icalendar-datetime-from-timestamp some-other-timestamp)))
  ;; subcomponents:
  (list (icalendar-make-valarm ...))
  ...)
           

and get a struct back that you could then send directly to a function
like 'icalendar-print-component' or similar. Does that seem like a
reasonable approach, or is it already too cumbersome? (Would you prefer
e.g. to just be able to write the appropriate data structure as a
backquoted (p)list?)

Best,
Richard



  parent reply	other threads:[~2024-10-23  9:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18  9:01 Improving Emacs' iCalendar support Richard Lawrence
2024-10-18  9:24 ` Eli Zaretskii
2024-10-19  8:22   ` Richard Lawrence
2024-10-19 10:11     ` Eli Zaretskii
2024-10-20  5:08       ` Richard Lawrence
2024-10-20  5:21         ` Eli Zaretskii
2024-10-18 12:58 ` Sebastián Monía
2024-10-19  8:28   ` Richard Lawrence
2024-10-19  5:44 ` Adam Porter
2024-10-19  8:39   ` Richard Lawrence
2024-10-20  3:09     ` Adam Porter
2024-10-22 18:40     ` Ihor Radchenko
2024-10-23  7:29       ` Björn Bidar
2024-10-23  9:01       ` Richard Lawrence [this message]
2024-10-23 20:24         ` Ferdinand Pieper
     [not found]       ` <87plnr6zvk.fsf@>
2024-10-23  8:09         ` Ihor Radchenko
2024-10-23  9:05         ` Richard Lawrence
2024-10-23 10:03           ` Björn Bidar
2024-10-21  6:10 ` Björn Bidar
2024-10-21  6:22 ` Visuwesh
2024-10-23  9:15   ` Richard Lawrence
2024-10-23  9:45     ` Visuwesh

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87bjzbp509.fsf@ohm.mail-host-address-is-not-set \
    --to=rwl@recursewithless.net \
    --cc=adam@alphapapa.net \
    --cc=emacs-devel@gnu.org \
    --cc=yantar92@posteo.net \
    /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.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).