emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying the parse tree


From: Ihor Radchenko
Subject: Re: Modifying the parse tree
Date: Thu, 25 May 2023 11:29:21 +0000

bvchgvbt@mail.com writes:

>> 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.

I know for sure about whitespace. We have some tests for interpreter,
but this has never been tested thoughtfully for the use cases like yours.
Should be mostly fine though, except some edge cases that you can report
as bugs. The original aim of `org-element-interpret-data' is creating
equivalence between the parse tree and the buffer text.

>> > "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"))

Yes, it is invalid.  You must always have :level.
You might try https://github.com/ndwarshuis/org-ml, though I plan some
breaking changes affecting org-ml soon.

-- 
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 via email to

[Prev in Thread] Current Thread [Next in Thread]