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: Upstreaming org-element-ast (was: Improving Emacs' iCalendar support) Date: Tue, 31 Dec 2024 08:55:09 +0100 Message-ID: <87cyh8guci.fsf@recursewithless.net> References: <87ed4dss2x.fsf@ohm.mail-host-address-is-not-set> <87mshq9w5c.fsf@ohm.mail-host-address-is-not-set> <86ed31j6zk.fsf@gnu.org> <87ldx9vsnb.fsf@localhost> <868qt8kj6f.fsf@gnu.org> <87ikscx5io.fsf@localhost> <867c8skhy6.fsf@gnu.org> <87frngx4fx.fsf@localhost> <864j3wkczm.fsf@gnu.org> <87cyhg0zjz.fsf@localhost> <87ttamtf7g.fsf@recursewithless.net> <87h66l2isk.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="31098"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 31 08:56:37 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 1tSX7E-0007v4-7J for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Dec 2024 08:56:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSX65-0000xh-FV; Tue, 31 Dec 2024 02:55:25 -0500 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 1tSX62-0000wp-6G for emacs-devel@gnu.org; Tue, 31 Dec 2024 02:55:22 -0500 Original-Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tSX60-0005lT-1l for emacs-devel@gnu.org; Tue, 31 Dec 2024 02:55:21 -0500 Original-Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id D1D1013801D0; Tue, 31 Dec 2024 02:55:17 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 31 Dec 2024 02:55:17 -0500 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=fm1; t=1735631717; x=1735718117; bh=4kBsYUlnjyBjXNGFhdqF342PEMSC/3MGhP2AEh0bUTU=; b= CYlmWP5DfrlPcfLASESDrJWlMu/AcDm6PTWhZZzwJierVNZQzMcx9a4fZAELzl51 ZvrB4KA6a28Fh1poCaODSuQ7/N+PZCMne9W6jAVhFft1Y3damtTkAXV1iCa7LpDS IE6/aGgxG7Pedu2r/okSNb3MgnCHTs8LJwNqdtdzc6+40lPfihKnTGaaiQWmMqmb vYDN1K5wKo1Juev1741mef8lyAniO1UDJ8shcohbgVE6+SVdc7/LsFCK04I5iDzg M9HygY1e8x3XTHrqW4peudXwHfBFGtmI8FiVpuDFf3YghO/03hYzWs+K1jqcxS75 StT7M2F5iOBs7QkII6T2xQ== 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-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1735631717; x=1735718117; bh=4kBsYUlnjyBjXNGFhdqF342PEMSC/3MGhP2 AEh0bUTU=; b=HRJwd5ZQNxqhmAhsbATeU+NuK/RFIC6Tfqx50LRPhWsAWdGlR7k e7nPCiyidOxJfwZj7jOfOOFjxsm0YceDUbFtfcBg6Q3N0UM5KPTghFOqvaltwhvO vpp36j/YyarQ95yLKjyxwKYwjzGVAH9DrW4sTPaF+nvTHqGi7EOXcYkCVn1FUCGp DmJH9n1DJZRJUwNdwMyCzNmfYJzEr/eAyuPvzVUPtX8CnU0HOJYuZQ2mcMPeDdCJ 2YpmvmorLrQK0mVTQe+tm8yE3jS1oi3BYpM9sJtZHq4yr+q4ywgw+fUFlDMaHlaI q21UfTHn2in7FOSbdQtX9SeWaCSFd+G0jIQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddvjedguddufecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvve fujghffffkgggtsehttdertddttddtnecuhfhrohhmpeftihgthhgrrhguucfnrgifrhgv nhgtvgcuoehrfihlsehrvggtuhhrshgvfihithhhlhgvshhsrdhnvghtqeenucggtffrrg htthgvrhhnpeefueffvdeffeeftdeutdfgjeettdduveduudefjedtkeejgfehhedvgffg ffduhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hrfihlsehrvggtuhhrshgvfihithhhlhgvshhsrdhnvghtpdhnsggprhgtphhtthhopedv pdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeihrghnthgrrhelvdesphhoshhtvg hordhnvghtpdhrtghpthhtohepvghmrggtshdquggvvhgvlhesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: if7394488:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 31 Dec 2024 02:55:17 -0500 (EST) In-Reply-To: <87h66l2isk.fsf@localhost> Received-SPF: pass client-ip=103.168.172.146; envelope-from=rwl@recursewithless.net; helo=fout-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_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-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:327482 Archived-At: Hi Ihor, Ihor Radchenko writes: > The main question is making things usable outside Org mode. > And that's where your work is the most valuable. > So, it was me who is waiting for your input before upstreaming :) Got it! I sat down yesterday and tried to convert to using org-element-ast, and I've run into a couple of questions: 1) Is there any way to use my own list of standard-properties? In particular, besides :begin, :end, :contents-begin, :contents-end, I'd like to have :value-begin and :value-end as standard properties, and always include (:value) in :secondary. If there's no way to do that yet, I think it would be useful to add for use outside of org. 2) I'm finding org-element-create rather unintuitive to work with, I think because of its &rest argument for children and the handling of "anonymous" nodes. In all my use cases, I build up children as an explicit list of nodes before calling icalendar-make-ast-node, which stores the list in the children slot, and returns that list from icalendar-ast-node-children. An interface like (org-element-create type props children) would be sufficient for me, where children is a list of nodes (and hence can be nil). As it is, I can't figure out how to call org-element-create and org-element-contents in the right way to set the contents of a node to a list of other nodes, and return that list from org-element-contents. I always seem to end up with an extra level of nesting. e.g. Instead of (child1 child2 child3 ...) org-element-contents returns ((child1 child2 child3 ...)). Likewise, if there are no children, instead of nil it returns (nil). I can't figure out why this happens; as far as I can tell, I'm calling both org-element-create and org-element-contents in the right way. I tried to write a wrapper for org-element-create using apply, with children as the last argument, like (apply #'org-element-create type props children) but that didn't help. I also tried just unconditionally unwrapping the list returned by org-element-contents by just taking its car. But (if I remember right) that seemed to create one level too *few* of nesting in at least some cases, such that org-element-contents would return stuff from the properties list. Can you help me understand what the right thing for me to do here is? All I want to do is store a list of child nodes at construction time, and get that list back later on, which seems like it should be a simple thing to do. In any case, it might be worth reviewing the interfaces and docstrings for these functions, because there is something about how they work that I clearly don't understand yet, and might be surprising to other library consumers. Hope that's useful feedback! Best, Richard