[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug: org-element-at-point on headline does not contain :parent prope
From: |
Nicolas Goaziou |
Subject: |
Re: Bug: org-element-at-point on headline does not contain :parent property [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)] |
Date: |
Wed, 05 Feb 2020 13:55:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hello,
Ihor Radchenko <address@hidden> writes:
>> Probably the docstring needs to be adapted - Nicolas knows this area
>> better than me.
>
> Do you mean that :parent property may not always be present?
`org-element-at-point' returns only a partial parse tree. It never goes
higher than the current top-level element, i.e., from an element, you
cannot go up to the headline just following :parent.
Luckily, headlines are exactly where you do _not_ need Element library.
`org-back-to-heading' and `org-up-heading-safe' will always be faster,
and as accurate. I.e., the code operating on headlines is usually
distinct from the code handling other elements.
> If so, it is quite disappointing. It would be helpful to be able to find
> parent of any element at point (especially, in conjunction with
> org-element-cache). At least, optionally.
You can parse the full document and get all the :parent properties
filled. That's not the job for `org-element-at-point'.
> I was counting on this feature to try speeding up my agenda generation
> (using org-element-cache).
Note that `org-element-cache' was disabled a while ago because it could
introduce freezes. I think this is related to how this part handles
`before-change-functions' and `after-change-functions'. Anyway, YMMV.
Regards,
--
Nicolas Goaziou