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: Tue, 16 Aug 2022 12:31:41 +0800

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

>> However, I do insist on my statement that expecting major-mode to not
>> widen is a bug.
>
> No, it's a design decision, which makes it possible to use specific
> implementation techniques.  Org-mode's support for multiple major modes
> (org-babel) uses an implementation technique that does not require
> narrowing.  Both approaches have their virtues and downsides, but if the
> submode widens then the supermode has less freedom in terms of which
> implementation technique to use.

I agree that major-mode doing (widen) may be problematic. However, at
least Org mode does need to do it in order to parse the buffer.

>> There are valid cases when a major mode needs to examine
>> the whole buffer.
>
> Not if the whole buffer contains text which the major mode can't
> understand.  There are valid cases where a major mode needs to widen,
> indeed, but not when called from font-lock or from
> `indent-line-function`.

`org-indent-line' (the value of `indent-line-function' in Org mode) does
require invoking parser in order to determine the syntactic object at
point, which, in turn, needs to consider the full buffer contents. This
is prescribed by Org syntax. We cannot avoid this.

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