From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Lawrence Newsgroups: gmane.emacs.devel Subject: Re: Improving Emacs' iCalendar support Date: Wed, 23 Oct 2024 11:01:26 +0200 Message-ID: <87bjzbp509.fsf@ohm.mail-host-address-is-not-set> References: <87ed4dss2x.fsf@ohm.mail-host-address-is-not-set> <0bacd69a-7941-44d2-ac5e-3ae3f256481a@alphapapa.net> <87r08cqye8.fsf@ohm.mail-host-address-is-not-set> <87zfmwyoa9.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27394"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Adam Porter , emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 23 11:04:00 2024 Return-path: Envelope-to: ged-emacs-devel@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 1t3XHb-0006ut-7i for ged-emacs-devel@m.gmane-mx.org; Wed, 23 Oct 2024 11:04:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3XFc-0007Ml-IV; Wed, 23 Oct 2024 05:01:57 -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 1t3XFK-0006yh-Vx for emacs-devel@gnu.org; Wed, 23 Oct 2024 05:01:39 -0400 Original-Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3XFI-0000hz-HN for emacs-devel@gnu.org; Wed, 23 Oct 2024 05:01:38 -0400 Original-Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 29CE71140194; Wed, 23 Oct 2024 05:01:34 -0400 (EDT) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 23 Oct 2024 05:01:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= recursewithless.net; h=cc:cc:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1729674094; x=1729760494; bh=C4VWjquQx3PEXpKU/8qHAPLD/C659yuow72CWLEF5zM=; b= TTDMRmoZRe1zneC5cLpaH3AjRZqt0PbUyaxXrbbj1UHEAHikVq+9Pzm7ga/8mm7e /M9abg1CkpYMac3gZN+96zHZOo2HtxtuWMP8byTXgpf9Pw2Ix+ggOnzExRggULHw c2WsfElVvtI32RPP6AAx7oBSjd2IkV2KCymZVz6b/gS9eTBEQb/cxoLcjBXHPJ7R PwMjDlpNM9HjSRFFtC+mcSpd/F6yPYmIdxT1DpQ1EZoC9GRF06DXyEL8fFrw/ulk DIBAG6+INRvJM8Vf+iYST9lVYrSOMejhOrqMUTzpp/+TuMPL9obuoHBH2733k8TM TFj8pajxjAagaJgyiQRwVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1729674094; x=1729760494; bh=C4VWjquQx3PEXpKU/8qHAPLD/C65 9yuow72CWLEF5zM=; b=YXNwNBlnIx8yYmDI3fyV81++u7pKI2crY9h4zLP9OLlz 6N3LFaNLPrVz+vS0n4ZIYxbK0s1qAESoPtgILK+YB5yvvQ+lPndtHwrdsqfBwNT/ z5DZ71vZR33F+QFmw43M0/sy6omir61mUectp22jyMI64Gh7RJQy3e8k+rtF6cpQ 7+8O2lcl6tMS8XYuwWRpgKf6guwwnpD2Sltwd18DQU2Q6+7W/5bXovVM9hRWJjdJ g2WyYx7aN1Ti2EJ5Z5EShYVbPwNOhyzqeoYtMRGHpOAcoaoiEPT18lzrAuE+/7we oIJ0Se7VPDdFoah1PqgTwAGXTxBFLDjy+UeKd5g8yw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeijedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecu hfhrohhmpeftihgthhgrrhguucfnrgifrhgvnhgtvgcuoehrfihlsehrvggtuhhrshgvfi hithhhlhgvshhsrdhnvghtqeenucggtffrrghtthgvrhhnpeetgedukeejffffudehfedv heeuudeijefhgfehfffhgfdthfejudejudevgfelgfenucffohhmrghinhepghhithhhuh gsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mheprhiflhesrhgvtghurhhsvgifihhthhhlvghsshdrnhgvthdpnhgspghrtghpthhtoh epfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohephigrnhhtrghrledvsehpohhs thgvohdrnhgvthdprhgtphhtthhopegruggrmhesrghlphhhrghprghprgdrnhgvthdprh gtphhtthhopegvmhgrtghsqdguvghvvghlsehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: if7394488:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Oct 2024 05:01:33 -0400 (EDT) In-Reply-To: <87zfmwyoa9.fsf@localhost> Received-SPF: pass client-ip=103.168.172.154; envelope-from=rwl@recursewithless.net; helo=fhigh-a3-smtp.messagingengine.com 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324778 Archived-At: Hi Ihor, Ihor Radchenko 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