Next: Motion and Syntax, Previous: Syntax Table Functions, Up: Syntax Tables
When the syntax table is not flexible enough to specify the syntax of
a language, you can override the syntax table for specific character
occurrences in the buffer, by applying a syntax-table
text
property. See Text Properties, for how to apply text properties.
The valid values of syntax-table
text property are:
(
syntax-code .
matching-char)
nil
nil
, the character's syntax is determined from
the current syntax table in the usual way.
If this is non-
nil
, the syntax scanning functions, likeforward-sexp
, pay attention tosyntax-table
text properties. Otherwise they use only the current syntax table.
This variable, if non-
nil
, should store a function for applyingsyntax-table
properties to a specified stretch of text. It is intended to be used by major modes to install a function which appliessyntax-table
properties in some mode-appropriate way.The function is called by
syntax-ppss
(see Position Parse), and by Font Lock mode during syntactic fontification (see Syntactic Font Lock). It is called with two arguments, start and end, which are the starting and ending positions of the text on which it should act. It is allowed to callsyntax-ppss
on any position before end. However, it should not callsyntax-ppss-flush-cache
; so, it is not allowed to callsyntax-ppss
on some position and later modify the buffer at an earlier position.
This abnormal hook is run by the syntax parsing code prior to calling
syntax-propertize-function
. Its role is to help locate safe starting and ending buffer positions for passing tosyntax-propertize-function
. For example, a major mode can add a function to this hook to identify multi-line syntactic constructs, and ensure that the boundaries do not fall in the middle of one.Each function in this hook should accept two arguments, start and end. It should return either a cons cell of two adjusted buffer positions,
(
new-start.
new-end)
, ornil
if no adjustment is necessary. The hook functions are run in turn, repeatedly, until they all returnnil
.