emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Getting the components of an item in a plain-list


From: Ihor Radchenko
Subject: Re: Getting the components of an item in a plain-list
Date: Mon, 05 Jun 2023 14:50:29 +0000

bvchgvbt@mail.com writes:

> If I have a plain-list element that looks something like
>
> ...
> I seem to be able to get the items from the list using
>
>     org-element-property :structure
>
>     (260 2 "- " nil nil nil 338)
> ...
> But if I try to use org-element-property on that, of course it
> fails because it's not an element, as I understand it, rather
> it's an object(?).

List structure is a semi-internal property, parsed using very old code,
not fully compatible with the rest of org-element API. Please check
`org-list-struct' and other functions in lisp/org-list.el to find how to
retrieve information about list structure. Or just not use it.

> Explanation:
> What I'm trying to do overall is to get the various details out
> of a list item that might look like:
>
>   - State "DONE"       from "NEXT"       [2023-06-05 Mon 10:54] \\
>     example
>
> So I'd like to be able to get the date of the timestamp (this
> isn't an absolute requirement, I'm happy enough to just using the
> current date), and the "example" text (which, obviously, isn't
> always "example"). If I have to use buffer-substring-no-properties
> and my car & car (above) then I will, but it would be nice to
> know there's an easier/better/more appropriate way of getting at
> what I want.

Here, you should better use `org-element-context' - it will parse on
object level, down to list items, paragraphs, and the containing objects.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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