emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: bvchgvbt@mail.com
To: orgmode ml <emacs-orgmode@gnu.org>
Subject: Getting the components of an item in a plain-list
Date: Mon, 5 Jun 2023 12:18:38 +0200	[thread overview]
Message-ID: <trinity-0134c0c1-f29c-4fe2-af73-96a6cac9c38e-1685960318853@3c-app-mailcom-lxa03> (raw)

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 10:18 bvchgvbt [this message]
2023-06-05 14:50 ` Getting the components of an item in a plain-list Ihor Radchenko

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=trinity-0134c0c1-f29c-4fe2-af73-96a6cac9c38e-1685960318853@3c-app-mailcom-lxa03 \
    --to=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).