bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#56682: Fix the long lines font locking related slowdowns


From: Ihor Radchenko
Subject: bug#56682: Fix the long lines font locking related slowdowns
Date: Mon, 15 Aug 2022 10:10:36 +0800

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Ihor Radchenko [2022-08-15 09:23:21] wrote:
>> Dmitry Gutov <dgutov@yandex.ru> writes:
>>> Do you have examples of such modes?
>>> Calling 'widen' inside font-lock-keywords is a bug, and the bugs should 
>>> be fixed at the source.
>> widen inside save-restriction is likely used by Org mode (or will be).
>
> Why?

Because Org syntax is context-dependent, and we may need to look
backwards to determine the "container" element before knowing what the
element at point is.

>> This is needed by Org parser to determine the syntax element at point.
>
> But font-lock widens before using Org-mode's `font-lock-keywords`, so
> there should be no need for Org-mode to widen in that case.

Yes, but Org parser is not written explicitly for font-locking purposes.
org-element-at-point knows nothing about buffer restriction upon
calling and thus has to widen to ensure correctness.

> PS: Not sure if Org-mode qualifies as a mode that is likely to suffer
> from the kinds of long-lines or large-file problems that Gregory has
> tried to tackle, tho.  I've never seen an Org file with lines >10kB nor
> an Org file larger than 10MB.

I have seen very long lines in Org. Specifically, in source block
output. (http query)

My notes.org file is over 20Mb.
Even larger files can be auto-generated by https://gitlab.com/publicvoit/Memacs

-- 
Ihor Radchenko,
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]