all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: bvchgvbt@mail.com
Cc: orgmode ml <emacs-orgmode@gnu.org>
Subject: Re: Modifying the parse tree
Date: Thu, 25 May 2023 11:29:21 +0000	[thread overview]
Message-ID: <87o7m8wsxa.fsf@localhost> (raw)
In-Reply-To: <trinity-5e839b03-4963-4540-8e83-43e7672bb573-1685013345197@3c-app-mailcom-lxa13>

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	other threads:[~2023-05-25 11:26 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
2023-05-25 11:29     ` Ihor Radchenko [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7m8wsxa.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.