From: Ihor Radchenko <yantar92@posteo.net>
To: Morgan Smith <morgan.j.smith@outlook.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: `org-element-cache-map' misses elements at end of buffer
Date: Sun, 21 Apr 2024 17:31:23 +0000 [thread overview]
Message-ID: <87edaypqqc.fsf@localhost> (raw)
In-Reply-To: <CH3PR84MB3424F819427E03418F5E4AF7C5132@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>
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>
next prev parent reply other threads:[~2024-04-21 17:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 13:33 `org-element-cache-map' misses elements at end of buffer Morgan Smith
2024-04-19 11:39 ` Morgan Smith
2024-04-21 11:48 ` Ihor Radchenko
2024-04-21 16:06 ` Morgan Smith
2024-04-21 17:31 ` Ihor Radchenko [this message]
2024-04-19 13:29 ` 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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87edaypqqc.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=morgan.j.smith@outlook.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).