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

From: Stefan Monnier <[email-masked]>
Date: Mon, 15 Aug 2022 10:26:00 -0400

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

> 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`.

        Stefan