emacs-devel
[Top][All Lists]
Advanced

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

Re: Major modes using `widen' is a good, even essential, programming pra


From: Eli Zaretskii
Subject: Re: Major modes using `widen' is a good, even essential, programming practice.
Date: Tue, 09 Aug 2022 14:30:28 +0300

> Date: Tue, 9 Aug 2022 00:16:23 +0300
> Cc: acm@muc.de, gregory@heytings.org, emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> 
> On 08.08.2022 14:30, Eli Zaretskii wrote:
> > So if you dislike the current solution of locked narrowing, how about
> > making syntax-ppss work in chunks (perhaps from an idle timer?), after
> > initially scanning only the first small portion of the file.  The goal
> > is to have the file displayed quickly enough, and thereafter complete
> > the scan when possible.
> 
> The file is already displayed "quickly enough".

What do you mean by "quickly enough"?  With this recipe:

  emacs -Q
  M-: (setq long-line-threshold nil) RET
  M-: (setq syntax-wholeline-max most-positive-fixnum) RET

visiting dictionary.json, a 19MB single-line file, takes "forever" (I
killed it after 20 minutes) before it shows anything in the window.
And since both variables use "arbitrary restrictions", and both can
cause inaccurate/incorrect/wrong/buggy/<your euphemism here>
fontifications, my proposal above was to do something smarter.

> What's going to happen then, if the timer hasn't fired yet?

We should process a relatively small portion of the buffer around the
new position of point.

Not surprisingly, this is precisely how jit-lock is supposed to work,
if only the stuff called through fontification-functions obeyed the
region which it was told to process.

> And for the timer's work to be useful, it has to had happened
> between the last edit and the subsequent navigation. A lot of idle
> timers like that = a lot of discarded work.

Not if the user will subsequently visit the place where the "discarded
work" was invested.

Full disclosure: I'm a long-time and very happy user of
jit-lock stealth fontifications.



reply via email to

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