emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: bvchgvbt@mail.com
To: orgmode ml <emacs-orgmode@gnu.org>
Subject: Re: Modifying the parse tree
Date: Thu, 25 May 2023 13:15:45 +0200	[thread overview]
Message-ID: <trinity-5e839b03-4963-4540-8e83-43e7672bb573-1685013345197@3c-app-mailcom-lxa13> (raw)
In-Reply-To: <87wn0wwugx.fsf@localhost>

"Ihor Radchenko" wrote:
> bvchgvbt@mail.com writes:

> Parse tree is not kept in sync with the original buffer when you
> retrieve it by `org-element-parse-buffer'.

Okay, thanks. I thought that might be the case, but couldn't be sure.

> We generally do not currently
> have a way to modify Org buffer text from AST.
>
> The only way to write the parse tree back is
> replacing it with the output `org-element-interpret-data'.

Okay, fair enough. Thanks for the info.

> But be aware
> that interpreted tree and the original text do not have exact 1-to-1
> equivalence. Some whitespace might be lost.

Only whitespace? I can live with that.

> > "org-element-headline-interpreter: Wrong type argument: wholenump, nil"
>
> Which implies that you added invalid headline element to the tree.

Hmm. Does
headline (:title hello :todo-keyword TODO :todo-type todo)
look valid to you as a minimal TODO-type headline? Created via:

  (let ((todo (org-element-create 'headline)))
    (org-element-put-property todo :title todo-title)
    (org-element-put-property todo :todo-keyword "TODO")
    (org-element-put-property todo :todo-type "todo"))



  reply	other threads:[~2023-05-25 11:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 10:22 Modifying the parse tree bvchgvbt
2023-05-25 10:55 ` Ihor Radchenko
2023-05-25 11:15   ` bvchgvbt [this message]
2023-05-25 11:29     ` Ihor Radchenko
2023-05-26 11:27       ` bvchgvbt
2023-05-26 14:35         ` 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-5e839b03-4963-4540-8e83-43e7672bb573-1685013345197@3c-app-mailcom-lxa13 \
    --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).