emacs-devel
[Top][All Lists]
Advanced

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

Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text prope


From: Andreas Röhler
Subject: Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.]
Date: Sat, 12 Mar 2016 21:19:54 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Icedove/38.5.0



On 11.03.2016 13:08, Alan Mackenzie wrote:
Hello, Andreas.

On Fri, Mar 11, 2016 at 08:27:17AM +0100, Andreas Röhler wrote:


Well, given that syntax-ppss is not suitable for fixing back_comment,
the alternatives are not fixing it, substantially amending syntax-ppss,
using my new code, or fixing it some other way.  I really think it
should be fixed.  You don't want syntax-ppss to be changed.  Do you have
an idea for an "other way"?
There is neither a need nor a way to fix syntax-ppss : Determining
syntax must check from beginning of buffer, as parse-partial-sexp does.
parse-partial-sexp is in C, it's fast.
parse-partial-sexp starts scanning from where you ask it to, optionally
starting with a parse state returned by a previous invocation.  Although
it's fast, it's not all that fast when repeatedly run over large
portions of a large buffer.  This is what syntax-ppss was intended to
solve.

The position syntax-ppss notionally starts scanning from is
indeterminate.  Sometimes it's the beginning of buffer, sometimes it's
the beginning of the visible portion of the buffer, sometimes it's some
former beginning of visible portion.

Its documentation is confused, too.  The entry in the elisp manual says
"beginning of buffer".  The doc string string says "point-min".

I disagree about the need to fix syntax-ppss - medium level functions
should be rigorous and determinate.



Needed or not: it's impossible. The idea of a cache WRT to comments can't work. Every insert may start a new multiline-comment at pos 1. How a cache will detect that? The results of syntax-ppss are hardly predictable.





reply via email to

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