emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: "Somelauw ." <somelauw@gmail.com>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
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	[thread overview]
Message-ID: <87o9kcysji.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <m28tbgju01.fsf@andrew.cmu.edu> (John Kitchin's message of "Sun, 25 Feb 2018 19:43:26 -0800")

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> 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 <https://orgmode.org/worg/dev/org-element-api.html>

> 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

      reply	other threads:[~2018-02-26 10:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 23:29 Expose value-begin and value-end instead of just value in org-element API Somelauw .
2018-02-20 19:59 ` John Kitchin
2018-02-21 11:17   ` Nicolas Goaziou
2018-02-21 21:13     ` Somelauw .
2018-02-26  3:43     ` John Kitchin
2018-02-26 10:05       ` Nicolas Goaziou [this message]

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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9kcysji.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=somelauw@gmail.com \
    /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/org-mode.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).