bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16526: 24.3.50; scroll-conservatively & c-mode regression


From: martin rudalics
Subject: bug#16526: 24.3.50; scroll-conservatively & c-mode regression
Date: Mon, 27 Jan 2014 09:20:57 +0100

> After beginning-of-buffer jumps to point-min, redisplay kicks in.
> Since scroll-conservatively is set to a large value, redisplay first
> tries to see whether it can bring point into view by scrolling the
> window as little as possible.  It calls try_scrolling, which at some
> point (around line 15000) tries to see whether the new location of
> point is close enough to the current window start.  It does so by
> calling move_it_to, which simulates the display.  While doing so,
> move_it_to hits a portion of text with font-lock properties, and calls
> JIT Lock to fontify them.

Well... try_scrolling could detect that `point' is some 15000 lines away
from the current window start so trying to scroll the window as little
as possible might not be worth the effort.

> And here's where things go awry: For some reason, the CC Mode
> fontification code decides it needs to scan the buffer backwards,
> starting from EOB.  So it goes temporarily to EOB (this is why I saw
> point being there), and scans all the way back, I think in this loop
> from c-append-lower-brace-pair-to-state-cache, which is called with
> its first argument FROM set to EOB:

But it's redisplay which temporarily puts `point' at EOB and triggers
the fontification subsystem to "work" at that position?

> This loop takes a lot of time, of course, and is a waste of time,
> since eventually try_scrolling comes to the correct conclusion that
> scrolling is impossible, and instead recenters at BOB.

Are you sure that try_scrolling doesn't call this loop over and over
again?

> Why does CC Mode decide to go from EOB backwards, I don't know;
> presumably, this is decided by c-parse-state-get-strategy as part of
> c-parse-state-1.

This seems obvious.  To decide whether code shall be fontified this way
or another it has to decide whether the code is part of a comment and
find that comment's start.  As long as it is not aware of the fact that
`point' is already at BOB, obviously.

martin





reply via email to

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