GNU bug report logs - #56682
Fix the long lines font locking related slowdowns

Previous Next

Package: emacs;

Reported by: Gregory Heytings <gregory <at> heytings.org>

Date: Thu, 21 Jul 2022 18:01:01 UTC

Severity: normal

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 56682 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#56682: Fix the long lines font locking related slowdowns
Date: Mon, 01 Aug 2022 03:11:43 -0400
>> Your current code makes it impossible for a major mode to make Emacs slow
>> by widening in a too-long-line.
> Which is a good thing, isn't it?

No: we don't want to prevent people from shooting themselves in the foot.
Basically if it says "impossible" there's a good chance it's not a good thing.

> Or do you think that it's okay for Emacs to become unresponsive just
> because it is busy highlighting characters in the buffer?

Widening in a too long line will not necessarily lead to an unresponsive
Emacs, so by preventing it you're also preventing useful cases.

>> I'd prefer if we made it easy (i.e. the default) for Emacs to work well in
>> that case, without making it impossible for the major mode to mess
>> things up.
> Sure, I would also welcome a better solution.  Until it materializes, the
> only reasonable way is to use a less optimal solution.

It's not difficult to make it possible to re-widen after your narrowing.

> I just sent one such example to Dmitry.  And I pointed to another possible
> solution, namely to scan the whole buffer while opening it (instead of
> scanning it lazily, which is IIUC what currently happens).  From a user
> viewpoint, it's understandable that opening a big file takes some time.

We used to scan eagerly in the background with `jit-lock-stealth`, but that was
not very popular (eats up your battery for fairly little benefit).
We also have "lazier" highlighting via `jit-lock-defer`, but that hasn't
been adapted to `syntax-ppss`.  It might be with investigating.


        Stefan





This bug report was last modified 2 years and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.