[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax-propertize-function vs indentation lexer
From: |
Stephen Leake |
Subject: |
Re: syntax-propertize-function vs indentation lexer |
Date: |
Thu, 30 May 2013 05:15:06 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) |
Stefan Monnier <address@hidden> writes:
>> However, syntax-propertize-function is only called from font-lock. So it
>> only runs on the visible part of the buffer, and only when font-lock is
>> enabled. So if neither of those conditions is present, the lexer fails
>> on character constants. In particular, I have a test suite that runs in
>> batch mode, when global-font-lock-mode is off.
>
> "syntax propertization" is done lazily, so if/when you need it, you need
> to call `syntax-propertize'. In many cases it's done for you
> (e.g. indent-according-to-mode makes sure it's propertized til the end
> of the current line), but not in all cases.
The doc string for syntax-propertize-function only mentions
font-lock, not indentation etc; it should say "most syntax uses", or
better, list all the places it is called.
> Not sure why propertization isn't done for you in the case
> of indentation. Maybe because you sometimes look after the current line?
> Or because your indentation doesn't go through
> indent-according-to-mode?
The later; I'm parsing the entire buffer with an LALR parser in
ada-mode, and whenever it changes, and caching the results for use by
indent. So far it's quite fast.
So I need to call
(syntax-propertize (point-max))
in ada-mode and
(syntax-ppss-flush-cache begin)
(syntax-propertize end)
in the after-change hook.
--
-- Stephe