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

From: Alan Mackenzie <[email-masked]>
Date: Sat, 28 Jun 2014 17:33:34 +0000

Hi, Stefan.

On Sat, Jun 28, 2014 at 10:34:58AM -0400, Stefan Monnier wrote:
> > Where do we go from here?

> Not sure.  Would `syntax-ppss' return correct values from the code in
> question?  If yes, then changing back_comment to call back to Elisp and
> use syntax-ppss in the lossage case should eliminate this
> algorithmic problem.

No, syntax-ppss wouldn't do here without considerable modification.
scan-lists must be utterly robust.  syntax-ppss can get confused if the
user changes the syntax-table, or adds systax-table text properties, or
binds before-change-functions to nil and makes a change.

How about simply (tm) find-defun-start actually determining a defun
start (when open-paren-..-defun is nil) the first time it is called for
an invocation of scan-lists, then remembering this position for
subsequent use?  This would work well for the particular scan-lists
invocation we've been talking about.

As an enhancement, which would work well for scan-lists at top level
with a large negative COUNT, we could keep a list of top level positions
during the initial scan, say every ~5k characters.  (Or even store the
actual parse states every 5k characters exactly.)

Or something like that.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).