[Top][All Lists]

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

Re: font-lock-syntactic-keywords obsolet?

From: Stefan Monnier
Subject: Re: font-lock-syntactic-keywords obsolet?
Date: Mon, 20 Jun 2016 00:33:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> Changing CC Mode to use syntax-propertize-function would require a
> substantial amount of design work, assuming such were possible.

Actually, my experience with changing existing major modes to use
syntax-propertize is that there really isn't any need for a big redesign.

That includes non-trivial cases such as cperl-mode and nxml-mode.

So far, CC-mode has proved too impenetrable for my motivation [and your
constant rejection of any patch which aligns CC-mode with "all other
major mode" without also fixing a known bug doesn't help of course], but
it really usually boils down to finding those parts of the code which
apply `syntax-table', calling them from a new foo-syntax-propertize
function, and then finding those spots in the code that need
`syntax-table' to be applied, and adding calls to `syntax-propertize'
there (if any).
And then, performing tests to weed out the problems caused by the fact
that I really had no clue about what the code was doing.

In the case of CC-mode, this would result in losing the benefits of your
efforts to try and avoid unnecessary re-scans, but syntax-propertize's
laziness should hopefully make up for it.

> There doesn't seem to be a good reason to do this.

Admittedly, from the point of view of someone who only maintains
CC-mode, the benefits are probably slim (tho I'm pretty sure the result
would be easier to maintain in the long run).

But from the point of view of Emacs, there are some good reasons to try
and unify the way different major modes work.  E.g. so that there's
a standard agreed upon way for a package to know if point is inside
a comment, without having to know anything about the current major mode.
[ FWIW, CC-mode already interacts well enough with syntax-ppss that this
  particular need already works OK.  ]


reply via email to

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