emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: question on org-element-interpret-data and when it works
Date: Mon, 26 Feb 2018 11:10:13 +0100	[thread overview]
Message-ID: <87k1v0ysca.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAJ51ETrVMD85_HtePY4Z=qjZpV1v4mFg68rnKz5WpqHxO+WP5g@mail.gmail.com> (John Kitchin's message of "Sun, 25 Feb 2018 16:12:14 -0800")

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> I am trying to find some ways to programatically modify org-elements that
> use fewer regexps and motion commands. It seems like org-dp (
> https://github.com/tj64/org-dp) was intended to do that but it is not clear
> enough how you might use it, and it also doesn't seem to support
> plain-lists yet.

[...]

> It works on some things, e.g. headlines, src blocks. I put the point on one
> of those things, run this command, and then I can paste it somewhere to see
> that it did indeed work.
>
> But, it does not work on plain-lists, or paragraphs. I either get an empty
> string, or Wrong type argument: char-or-string-p, nil
>
> Is it possible to do what I am describing? Am I just missing how to get the
> element data in the right form?

You cannot change a non-terminal element without changing its contents.
In particular plain-lists, tables and paragraphs are fully defined by
their contents, i.e., they do not decorate contents like headlines. In
this case, data returned by `org-element-context' is incomplete in this
case. You probably need to parse the buffer between :begin and :end and
modify structure recursively.

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2018-02-26 10:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26  0:12 question on org-element-interpret-data and when it works John Kitchin
2018-02-26 10:10 ` Nicolas Goaziou [this message]
2018-03-03 11:43 ` Thorsten Jolitz
2018-03-03 12:45   ` Nicolas Goaziou
2018-03-03 13:02     ` Thorsten Jolitz
2018-03-03 13:20       ` Nicolas Goaziou
2018-03-03 13:39         ` Thorsten Jolitz
2018-03-03 14:06           ` Nicolas Goaziou
2018-03-03 14:47             ` Thorsten Jolitz

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=87k1v0ysca.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    /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).