[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug-reference-prog-mode slows down CC Mode's scrolling by ~7%

From: Alan Mackenzie
Subject: Re: bug-reference-prog-mode slows down CC Mode's scrolling by ~7%
Date: Thu, 2 Sep 2021 19:24:51 +0000

Hello, Stefan.

On Thu, Sep 02, 2021 at 14:46:51 -0400, Stefan Monnier wrote:
> >> > However, this mechanism is rendered ineffective if a second function
> >> > is add-hook'd onto jit-lock-functions.  Maybe this could be fixed,
> >> > though it looks difficult.
> >> I think we can "easily" handle this specific case if the
> >> `bug-reference-prog-mode` function is added to the end of the hook
> >> rather than to its beginning and use a patch along the lines of the
> >> one below.
> > Yes.  How about an optional parameter to jit-lock-register meaning "put
> > this function at the beginning of jit-lock-functions", with the default
> > meaning put the function at the end?

> Sure.  Basically, the idea is that the function which is most likely to
> grow the bounds (or to grow them most) should come first.

OK, thanks.

> > I haven't tried it, but I don't think the patch below is quite enough.

> I'd be surprised if it is, indeed, I just thought it was a better
> description of the intention than whatever I could come up in words.

Sorry, I didn't pick that up.  But I think I've worked out how to do it.

In words (;-), only the first function on jit-lock-functions should be
able to expand the region which gets `fontified' text properties.  This
expanded region will then be supplied to the subsequent functions.

Given how little used the `jit-lock-bounds' mechanism is (there is one
function in Emacs, font-lock-default-fontify-region, which uses it, and
a web search revealed only a single other instance, in lsp-mode on
git-hub), this shouldn't cause problems.  In fact, I'm not sure the
lsp-mode use of it is even correct.

>         Stefan

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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