[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modifying the parse tree
From: |
bvchgvbt |
Subject: |
Re: Modifying the parse tree |
Date: |
Thu, 25 May 2023 13:15:45 +0200 |
"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"))