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


Message #1567 received at 56682 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 56682 <at> debbugs.gnu.org, Gregory Heytings <gregory <at> heytings.org>,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#56682: Fix the long lines font locking related slowdowns
Date: Mon, 15 Aug 2022 23:40:35 +0300
On 15.08.2022 23:25, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> Dmitry Gutov [2022-08-15 22:54:30] wrote:
>> On 15.08.2022 22:25, Gregory Heytings wrote:
>>>> I've never seen fontification-functions contain anything but
>>>> jit-lock-function,
>>>>
>>> You did not read the thread carefully enough: two weeks ago it was
>>> mentioned that fontification-functions has at least two other users: in
>>> ELPA multi-mode.el sets fontification-functions to multi-fontify, and in
>>> MELPA poly-lock.el sets fontification-functions to poly-lock-function.
>>
>> Okay.  But those should be easily adapted to use jit-lock-functions instead.
> 
> IIUC they use `fontification-functions` to wrap the "select the current
> major mode" operation around the call to `jit-lock-function` so that
> each submode can use its own set of jit-lock clients.
> 
> It's harder to hook into `jit-lock-functions` to do that because you
> need to detect when `jit-lock-functions` is modified.

Do they detect when fontification-functions are modified? Sounds like 
just as much of a rare occurrence.

> AFAICT mmm-mode does not try to do that at all.

It does the wrapping through custom font-lock-fontify-region-function 
and syntax-propertize-function. The major mode specific values are saved 
after the major mode is called. Any subsequent modifications are just 
ignored.

>> They'll get all the corresponding performance improvements (just-in-time
>> fontification) as a bonus.
> 
> Not sure what you mean by that.  `fontification-functions` is already
> called "just-in-time" (and those packages don't re-implement jit-lock on
> their own, they just wrap themselves around jit-lock).

Okay then.

Sounds like somewhere in there there's a duplication of design still.

But also: if they go on to call jit-lock anyway, then they would go 
through whatever application of narrowing that we put in there. Be that 
in font-lock-fontify-region, or in jit-lock-function.




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

Previous Next


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