From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Expose value-begin and value-end instead of just value in org-element API Date: Mon, 26 Feb 2018 11:05:53 +0100 Message-ID: <87o9kcysji.fsf@nicolasgoaziou.fr> References: <87k1v6k2wt.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqFfT-00020P-Qn for emacs-orgmode@gnu.org; Mon, 26 Feb 2018 05:06:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqFfS-0006hf-DJ for emacs-orgmode@gnu.org; Mon, 26 Feb 2018 05:05:59 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:35960) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqFfS-0006gz-7Y for emacs-orgmode@gnu.org; Mon, 26 Feb 2018 05:05:58 -0500 In-Reply-To: (John Kitchin's message of "Sun, 25 Feb 2018 19:43:26 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: "Somelauw ." , "emacs-orgmode@gnu.org" Hello, John Kitchin writes: > Wow. I would not have guessed either one of these! Thanks for sharing > them. Is that documented somewhere? [...] > For elements with a :contents-begin where does :post-affiliated come in? See > Once you get the idea, maybe, but this approach seems specific to > src-blocks (maybe any block) where there are delimiting lines. It > doesn't work on all elements (which to be fair was not claimed). I think > the OP was interested in something more consistent, which I am > sympathetic to. Some elements are very different from others. What would be the innards of an horizontal line or a planning line? > Some things aren't clear to me what should happen though, especially in > composite elements like tables and plain lists. E.g. To just select a > table without the affiliated lines, one can use :contents-begin and > :contents-end, once you get the table element (e.g. by walking up the > :parent chain if you are in a cell or row). > > In the absence of a single way, maybe there could be a small number of > ways to do this? How many cases do you think there are? > > - blocks (which have :value) > - composite elements (which have :contents-begin/end and/or non-nil :parents) > - regular elements (which have :contents-begin/end) There is no difference between regular elements and composite elements. Also, all blocks do not have a value (e.g., center blocks). > I can see this argument, but I am still unclear on which elements need a > value, and which don't. For example, src-blocks have a value, but a > paragraph doesn't, nor do items in a plain list, at least from > (org-element-context). In a parse tree, some elements are terminal (i.e., leaves), others are not. Non-terminal elements have :contents-begin and :contents-end properties. Others have :value, if it makes sense, or nothing (e.g., planning lines). Source blocks are terminal elements. Paragraphs, lists and items are not. Regards, -- Nicolas Goaziou