emacs-orgmode
[Top][All Lists]
Advanced

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

Getting the components of an item in a plain-list


From: bvchgvbt
Subject: Getting the components of an item in a plain-list
Date: Mon, 5 Jun 2023 12:18:38 +0200

If I have a plain-list element that looks something like

    (plain-list (:type unordered :begin 260 :end
    571 :contents-begin 260 :contents-end 571 :structure ((260
    2 "- " nil nil nil 338) (338 2 "- " nil nil nil 413) (413
    2 "- " nil nil nil 489) (489 2 "- " nil nil nil
    571)) :post-blank 0 :post-affiliated 260 :parent nil))

I seem to be able to get the items from the list using

    org-element-property :structure

(per the documentation), giving me:

    ((260 2 "- " nil nil nil 338) (338 2 "- " nil nil nil
    413) (413 2 "- " nil nil nil 489) (489 2 "- " nil nil nil
    571))

and then the first list item using `car`, as I expected:

    (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(?).

So how do I get the the beginning and end? I can obviously just
do:

    (car list-item) ; head
    (car (last list-item)) ; tail

but I'm wondering if there's a better way.

----

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.

Thanks in advance.



reply via email to

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