[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 09:53:13 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> What about the text _before_ the change, should that become out of date
> (as it does in CC Mode)?

That's for the major mode to decide, and inform syntax.el about it via

And indeed, syntax-propertize-extend-region-functions doesn't mark the
previous text as out of date.  It only causes it to be re-propertized
when we end up re-propertizing the changed text.

This part of syntax.el is not heavily exercised, tho, because it's very
unusual to have changes at POS affect the syntax of text on
earlier lines.

[ In CC-mode you tend to do that in places where I wouldn't.  E.g. for
  raw-strings you propertize the raw string's opener differently if the
  string is properly closed or not, whereas I wouldn't have done so
  and most other major modes where similar issues can show up don't do
  it the way you do in CC-mode either.

  Obviously, you like that kind of behavior, and maybe you're right
  that it's superior.  I tend to dislike it, but maybe I'm just biased
  because I dislike the implementation cost behind it.  ]

>> No: as soon as you need to look at the `syntax-table' property, the
>> parts marked as "out of date" will have their outdated properties
>> removed+reapplied, so you'll be sure to get uptodate properties at that
>> time.
> This sounds like black magic.

Laziness is a standard tool in programmer's toolbox.


PS: by the way, I was much too busy at work, so I had to procrastinate
a little, and I think I have a very rough version of cc-mode using
syntax-propertize-function working.

reply via email to

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