emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: bvchgvbt@mail.com
Cc: orgmode ml <emacs-orgmode@gnu.org>
Subject: Re: Getting the components of an item in a plain-list
Date: Mon, 05 Jun 2023 14:50:29 +0000	[thread overview]
Message-ID: <874jnm0xqi.fsf@localhost> (raw)
In-Reply-To: <trinity-0134c0c1-f29c-4fe2-af73-96a6cac9c38e-1685960318853@3c-app-mailcom-lxa03>

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	other threads:[~2023-06-05 14:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 10:18 Getting the components of an item in a plain-list bvchgvbt
2023-06-05 14:50 ` Ihor Radchenko [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=874jnm0xqi.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=bvchgvbt@mail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).