Subject: bug#22983: [ Patch ] Re: bug#22983: syntax-ppss returns wrong result.

From: Dmitry Gutov <[email-masked]>
Date: Fri, 22 Sep 2017 17:09:03 +0300

Hi Alan,

On 9/19/17 11:47 PM, Alan Mackenzie wrote:

> I have done now, without the slightest cause for concern (see below).

Thank you. Should you commit the patch (with any documentation tweaks 
you deem necessary), or should I?

> I've done some semi-formal testing on it.  My semi-formal test log is:
> 
> (ii) Do some testing, using xdisp.c as test file.  A file.c will not have
>    other calls to syntax-ppss interfering with the tests.
>    o - 1. Normal working: check both caches stay empty.  They don't, because
>      syntax-ppss is used, I think, by font locking.
>    o - 2. Normal work in a narrowed buffer.  Seems OK.
>    o - 3. Switch back to widened.  Seems OK.
>    o - 4. Switch back to narrowed, same point-min.  Check the caches.  They
>      look OK.
>    o - 5. Switch to a different narrowing and (syntax-ppss (point-min)).  This
>      does indeed empty the syntax-ppss-narrow, as it should.  s-p-wide looks
>      unchanged.  Good.
>    o - 6. Get well filled caches for both narrow and wide regions.  With the
>      buffer wide, make a buffer change early in the buffer.  Check both caches
>      are properly trimmed.  They are.
>    o - 7. Repeat 6, but trim with the buffer narrow.  Both caches look OK, the
>      narrow cache being (nil).

Yes, this sounds fine. I've tried out most of those myself too, except 
usually without checking the cache contents. Just the syntax-ppss results.

It would be nice to have 2 or 3 of those added as automated tests, BTW.

> Maybe I should also try some heavy hacking in, say, Emacs Lisp mode as a
> kind of soak test, since elisp mode uses syntax-ppss quite a bit, I
> believe.

Sure, except emacs-lisp-mode seems to still retain certain 
indentation-related problems, even without this change.

I don't really expect to uncover problems from this patch much later. 
That's been the point of making the change as simple as possible.