unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Lawrence <rwl@recursewithless.net>
To: Ferdinand Pieper <ferdi@nand.xyz>, emacs-devel@gnu.org
Subject: Re: Improving Emacs' iCalendar support
Date: Thu, 24 Oct 2024 16:52:19 +0200	[thread overview]
Message-ID: <87y12d8sf0.fsf@ohm.mail-host-address-is-not-set> (raw)
In-Reply-To: <87plnqpnxr.fsf@pie.tf>

Hi Ferdinand,

Ferdinand Pieper <ferdi@nand.xyz> writes:

> Emacs is really lacking a central parser for iCalendar and a common
> internal representation of iCalendar items. I have ran over this
> several times, but was always very quick to shy away from working on a
> central overhaul of icalendar.el. I resorted to small extensions of
> gnus-icalendar.el to bring event (request) creation to gnus, which
> still is very much in a prototype state [1].
>
> While I started extending the gnus-icalendar-event EIEIO class to
> support property parameters, it ended up being very cumbersome to
> create new event objects with all parameters correctly set.

This is good feedback, thank you. Can you say more about what exactly
was cumbersome about it? (Was it the need to call various constructors,
instead of just consing up lists? or the need to interact with objects
via setters/getters? or lack of validation of parameter lists? or...?)

> I think structs could be a good fit for the internal representation.
> Creating these from scratch should still be kept fairly
> straightforward for ease of use. There could also be a translation
> function that creates the appropriate struct from a very basic list
> representation like this:
>
> --8<---------------cut here---------------start------------->8---
> (VCALENDAR
>  ((PRODID nil "-//...")
>   (VERSION nil "2.0"))
>  (VEVENT
>   (;; ...
>    (DTSTART ((VALUE "DATE")) "20241201")
>    (DTEND ((VALUE "DATE")) "20241231"))))
> --8<---------------cut here---------------end--------------->8---

Yes, as I'm sure you're aware, icalendar.el creates a list
representation like this. I've been thinking we might need such a
function anyway for the sake of backward compatibility. And the more I
think about it, the more I realize that a list representation with a few
accessors should be just fine for the "container" types (components,
properties, attribute lists).

The disadvantage of a representation like the one above is there is no
structure yet in the *value* types: e.g. "20241201" is just a string,
not a date. This is fine for export (assuming you've already validated
the data...) but when reading the data, one needs to parse these values
too, and this is what I've been using structs for so far.

So do you think it would still be too cumbersome to have a
representation like

> ... (DTSTART ((VALUE "DATE")) (icalendar-read-date "20241201"))

or even just

> ... (DTSTART ((VALUE "DATE")) ('icalendar-date . "20241201"))

where in the latter, 'icalendar-date is a cl type symbol and some magic
type dispatch will call the associated read function on the string at
an appropriate time?

Best,
Richard



  reply	other threads:[~2024-10-24 14:52 UTC|newest]

Thread overview: 29+ 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
     [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-23  9:01       ` Richard Lawrence
2024-10-23 20:24         ` Ferdinand Pieper
2024-10-24 14:52           ` Richard Lawrence [this message]
2024-10-24 17:45             ` Ihor Radchenko
2024-10-25 12:53               ` Richard Lawrence
2024-10-25 18:59                 ` Ihor Radchenko
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
     [not found] ` <87wmi29eaf.fsf@>
2024-10-26 17:49   ` Ihor Radchenko
2024-10-28 10:44     ` Björn Bidar
     [not found]     ` <87r080tslf.fsf@>
2024-10-28 19:09       ` Ihor Radchenko

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=87y12d8sf0.fsf@ohm.mail-host-address-is-not-set \
    --to=rwl@recursewithless.net \
    --cc=emacs-devel@gnu.org \
    --cc=ferdi@nand.xyz \
    /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).