[Top][All Lists]

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

Re: font-lock-syntactic-keywords obsolet?

From: Alan Mackenzie
Subject: Re: font-lock-syntactic-keywords obsolet?
Date: Mon, 20 Jun 2016 18:55:13 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Andreas.

On Mon, Jun 20, 2016 at 06:00:01PM +0200, Andreas Röhler wrote:

> On 20.06.2016 15:50, Dmitry Gutov wrote:
> > On 06/20/2016 04:37 PM, Stefan Monnier wrote:
> >>> I've tried doing this with an actual bug, namely bug #22983 
> >>> "syntax-ppss
> >>> returns wrong result".  That was over three months ago, and still there
> >>> is no fix.

> >> Indeed, no fix.  A few reasons:
> >> - Lack of a concrete case which suffers from it (not much immediate 
> >> benefit).
> >> - In many cases, it's easier to fix the other side (the caller of 
> >> syntax-ppss).
> >> - It's hard to fix it right, not because of syntax-ppss in particular,
> >>   but because it's hard to make a generic facility which can be fast by
> >>   using a cache, yet is not being told where is the real intended
> >>   beginning of the buffer.  In CC-mode you just decided to punt and
> >>   disallow the use of cc-mode where 1 is not the real beginning of the
> >>   C code.  So your approach suffers from the same problem (just the
> >>   other side of it) and you haven't fixed it either.

> >> This said, a quick&dirty fix (if such was needed, e.g. because of a 
> >> concrete
> >> case which exhibits the problem) would be to make syntax-ppss
> >> always widen (and maybe add a syntax-ppss-dont-widen).  Given that
> >> there's no real hurry to fix it, I'd rather we fix it right.

> > I'm very tempted to fix it by pushing the proposed patch into master, 
> > considering no viable alternative patch has been proposed so far, if 
> > only to avoid seeing Alan mention that bug for the 101th time

> IMHO syntax-ppss has many design issues, not a single one.

I agree wholeheartedly.

> I'd prever to see an example, where syntax-ppss can't be replaced by
> parse-partial-sexp.

Well, syntax-ppss was originally intended to give the result equivalent
to (parse-partial-sexp (point-min) pos), and probably does, providing the
buffer is never narrowed - with narrowing, you get a somewhat random

> From there designing a syntax-ppss capable of its tasks might be of
> interest.

One of the problems is that syntax-ppss, rather than just performing its
function, has the subsidiary function of applying syntax-table text
properties.  Eliminating this incoherence would be a good design aim.
In fact, finding a good way of applying the text properties would win
you a medal, in my eyes.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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