emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Improving Emacs' iCalendar support


From: Ferdinand Pieper
Subject: Re: Improving Emacs' iCalendar support
Date: Wed, 23 Oct 2024 22:24:48 +0200

(Resending just to list due to messed up spf entry; sorry for the trouble)

Hi Richard,

this effort to consolidate the iCalendar support is fantastic!

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.

Richard Lawrence <rwl@recursewithless.net> writes:

> (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?)

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---


Best,
Ferdinand

[1]  https://git.nand.xyz/emacs/gnus-icalendar-request/ or mirrored at 
https://github.com/fpiper/gnus-icalendar-request



reply via email to

[Prev in Thread] Current Thread [Next in Thread]