Subject: bug#16526: 24.3.50; scroll-conservatively & c-mode regression

From: Stefan Monnier <[email-masked]>
Date: Wed, 02 Jul 2014 15:40:55 -0400

>> FWIW, CC-mode is one of the last remaining major modes (at least the
>> only one I know of that's bundled with Emacs) that doesn't play nice
>> with syntax-ppss.
> Doesn't it?  First I've heard of it.

Well, I go by what you said:

    No, syntax-ppss wouldn't do here without considerable modification.

> Though of course, what comes out of syntax-ppss is going to be of
> limited value when you've got lines like this in your source:
>
>     #define FOO BAR /* accidentally unclosed comment.

Yes, sometimes you need to be a bit creative to get syntax-ppss
to behave.  But so far, I've always managed to coerce it acceptably.

> Just as a matter of interest, what code is there around which wants to
> use syntax-ppss on a CC Mode buffer?

It's used by various obscure packages like font-lock, newcomment, ...

>> Incidentally, AFAIK it's also the only code which uses
>> font-lock-extend-after-change-region-function ....
> Is that right?  Well, what do you know!  Still, it's a good facility to
> have around for when it's needed.  It avoids the need to have to advise
> font-lock after change functions, whilst still doing fontification right.

Other packages manage to do it right without it.
As soon as CC-mode is changed to use syntax-propertize-function,
I expect that it won't use font-lock-extend-after-change-region-function
any longer.

> CC Mode does what it has to do to do its job.  As you yourself, amongst
> others, have remarked, CC Mode deals with utter bastards of languages.
> Its caches are quite capable of being robust.  I'm not convinced that
> syntax-ppss is capable of being robust.  Some of its shortcomings are
> listed in syntax.el.

I don't think there's much point in comparing the track record of
caching bugs in syntax.el compared to cc-mode.

        Stefan