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: Dmitry Gutov
Subject: Re: Major modes using `widen' is a good, even essential, programming practice.
Date: Tue, 9 Aug 2022 17:38:22 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 09.08.2022 14:30, Eli Zaretskii wrote:
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.

I never recommended you to change any of those vars.

Doing that brings back pathological slowdowns that don't have anything to do with the speed of parse-partial-sexp.

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.

To speed up the jump to a far distant part of the buffer after doing an edit "here", the timer would have to parse the whole buffer between here and there. Or most of it.

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.

If you concerned with the speed of font-lock itself (and not with the speed of syntax-ppss cache maintenance which we've talked about before), and in your case it might be justified, given the unoptimized build, then using something like stealth fontifications could indeed speed up C-v/M-v. Not M->, though.

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]