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: Eli Zaretskii
Subject: bug#56682: Fix the long lines font locking related slowdowns
Date: Sun, 14 Aug 2022 08:23:39 +0300

> Date: Sat, 13 Aug 2022 22:08:25 +0300
> Cc: 56682@debbugs.gnu.org, gregory@heytings.org, monnier@iro.umontreal.ca
> From: Dmitry Gutov <dgutov@yandex.ru>
> 
> > Fontifying only the beginning of the file doesn't help when the file
> > is first shown at another point, like when Emacs or emacsclient is
> > invoked with the +NN[:nn] argument, or the user uses saveplace or
> > similar package.  That's admittedly rarer than starting at the
> > beginning, but it's a valid use case, and I wouldn't like us to
> > dismiss it.
> 
> The beginning of the file is the part of it which we can fontify quickly 
> enough while still doing it correctly.

I know, but we are not doing only what is easy to do, do we?  We do
(or should do) what the users expect.  In this case, if we want to
fontify some relatively small portion of the document, it should be
the portion around where the file is first displayed.

> Because the main alternative on offer is to use narrowing and thus risk 
> getting invalid syntax information.

That alternative is a direct and somewhat simplistic way of
restricting misbehaving fontification, so as to prevent them from
making Emacs unresponsive.  Smarter alternatives -- and you seem to be
arguing for such -- should be smarter, not less so.  They should be
like what you installed for JSON on master.

> So the "don't fontify past X" strategy is simply based on the idea
> that no fontification is probably better than unreliable and
> obviously incorrect one.

I disagree with that idea, but if someone agrees with you, they can
simply turn off font-lock.  As was already mentioned many times in
this endless discussion.

> Now, we could develop more complex approaches from there. But this can 
> be a starting point, and the user option allows people to choose the 
> strategy they're most comfortable with.

Sorry, I don't consider this (fontifying the beginning of a file) a
good starting point for making any progress towards smarter, faster
fontifications.  The new json-mode is such a starting point, but we
should do something similar for other major modes as well.





reply via email to

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