emacs-orgmode
[Top][All Lists]
Advanced

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

Re: `org-element-cache-map' misses elements at end of buffer


From: Ihor Radchenko
Subject: Re: `org-element-cache-map' misses elements at end of buffer
Date: Sun, 21 Apr 2024 17:31:23 +0000

Morgan Smith <morgan.j.smith@outlook.com> writes:

>> It is the time to refactor this function yet again.
>> (a tricky endeavour considering all the edge cases we can encounter when
>> there are changes in buffer while `org-element-cache-map' is mapping
>> over it).
>
> See attached for a way to break :from-pos as well.  I would like to help
> refactor but studying this function is a little dizzying for me.

At this point, it might be easier to rewrite the whole thing from
scratch, just based on the commentary (I tried my best to leave detailed
commentary explaining the intended logic). We have a decent test
coverage when mapping headings in buffer, so edge cases will be checked
by make test.

In particular, it might be a good idea to get rid of the idea of START
variable and just make use of AFTER-ELEMENT. For now, they serve kinda
the same purpose, but the latter was added because START was not enough
when the buffer is modified by FUNC.

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