GNU bug report logs -
#22983
syntax-ppss returns wrong result.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Fri, 11 Mar 2016 15:13:02 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
Message #117 received at 22983 <at> debbugs.gnu.org (full text, mbox):
Hi Alan,
On 9/7/17 11:45 PM, Alan Mackenzie wrote:
> The solution I propose is to introduce a second cache into syntax-ppss,
> and this cache would be used whenever (not (eq (point-min) 1)).
> Whenever point-min changes, and isn't 1, this second cached would be
> calculated again from scratch.
Thanks for writing this up. I think it's a good step, and since it
follow the current wording of the docstring, it should be highly
compatible with the existing code.
> This proposal has these advantages:
>
> (i) It would make the function deliver what its unchanged doc string
> says. This is important, given that syntax-ppss has been very widely
> used within Emacs, and likely by external packages too; these will
> typically have assumed the advertised behaviour of the function, without
> having tested it in narrowed buffers.
It will also continue to function as expected in mmm-mode, AFAICT,
without the need for an "escape hatch" we discussed before.
> (i) In the case which currently works, namely a non-narrowed buffer,
> there would be only a minute slow-down (basically, there would be extra
> code to check point-min and select the cache to use).
>
> (ii) The cache for use in a narrowed buffer might well be sufficiently
> fast in normal use. If it is not, it could be enhanced readily.
And since the API doesn't change, and the observable behavior doesn't
either (in the vast majority of cases; probably all except the broken
ones), we can refine this solution easily, or even swap it for something
else, with little cost.
> I think Dmitry also proposed a method of solution some months ago,
> though I don't remember in detail what it was. Dmitry, do you still
> think your solution would work? If so, please elaborate on it.
There is a simple patch at
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22983#47, but I after some
consideration, I now prefer your proposed approach. We've also had some
grander ideas about enhancing things further, but those can be added
later, after we finally decide.
I do want to know what Stefan thinks of this subject now, though.
Caveats:
- This solves the dependency on point-min, but does nothing about the
dependency on the current syntax-table (which can change). I'm not
necessarily suggesting we try to solve that now, though.
- Before this change is pushed to master, or shortly after, I'd like to
know that it actually fixed the problem Philipp experienced with
python-mode, so we can revert 4fbd330. If it was caused by e.g.
syntax-table changing, we've not improved much.
All the best,
Dmitry.
This bug report was last modified 7 years and 229 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.