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

From: Alan Mackenzie <[email-masked]>
Date: Tue, 19 Sep 2017 20:47:53 +0000

Hello, Dmitry.

On Tue, Sep 19, 2017 at 03:02:06 +0300, Dmitry Gutov wrote:
> On 9/18/17 10:08 PM, Alan Mackenzie wrote:

[ .... ]

> > So, I'm willing to go with your version.  I haven't tried actually
> > running it, yet.

> Please do.

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

> > But there's one small change I would ask you to consider making - that
> > is, in the cache conses, to put ppss-last in the car and ppss-cache in
> > the cdr.  That way, while debugging, ppss-last will be easy to find
> > (it's the first element of the list) and ppss-cache will also be easy to
> > find (the second element onwards).

> Sure, that makes a lot of sense, since ppss-last is a smaller structure. 
> The modified patch is attached.

Thanks.

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).

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.

-- 
Alan Mackenzie (Nuremberg, Germany).