[Top][All Lists]

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

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

From: Alan Mackenzie
Subject: Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.]
Date: Fri, 11 Mar 2016 12:08:08 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Andreas.

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

> On 10.03.2016 14:01, Alan Mackenzie wrote:
> > Hello, Stefan.

> > On Wed, Mar 09, 2016 at 04:40:45PM -0500, Stefan Monnier wrote:
> >>>>>> ...., so if you have a problem with the implementation, fix it (or
> >>>>>> report it as a bug, at the very least) and everyone else will benefit.
> >>>>> Perhaps you could fix the problems I've identified here and in my last
> >>>>> email.
> >>>> Why would I bother, since I don't even know of any real use case where
> >>>> those problems are triggered?
> >>> OK, fine.  So we go with my approach to back_comment, then?
> >> Why?
> > 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

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.

> Best,

> Andreas

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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