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: Stefan Monnier
Subject: bug#56682: Fix the long lines font locking related slowdowns
Date: Tue, 16 Aug 2022 09:20:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> 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's no doubt that a major mode may need to override a user's
narrowing in order to work correctly.  That doesn't mean that it
absolutely always needs to have access to the whole 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.

*All* indentation code needs to look at the context.  For that reason
`indent-according-to-mode` already widens as appropriate before calling
`indent-line-function`.  For that reason the function placed on
`indent-line-function` *never* needs to widen (and should never widen).


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]