emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Getting the components of an item in a plain-list
@ 2023-06-05 10:18 bvchgvbt
  2023-06-05 14:50 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: bvchgvbt @ 2023-06-05 10:18 UTC (permalink / raw)
  To: orgmode ml

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-05 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-05 10:18 Getting the components of an item in a plain-list bvchgvbt
2023-06-05 14:50 ` Ihor Radchenko

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