[Top][All Lists]

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

Clarification needed: syntax-propertize vs font-lock-syntax-table

From: Wedler, Christoph
Subject: Clarification needed: syntax-propertize vs font-lock-syntax-table
Date: Wed, 18 Nov 2015 18:06:53 +0000

The function `syntax-propertize' sets the syntax-table properties which
shadow the definition from the current syntax-table.  This function
calls the function in syntax-propertize-function whose docstring
explicitly allows to call `syntax-ppss'.

For this to work consistently, it is necessary that `syntax-propertize'
is called with the same (or very similar) syntax-table, at least for the
same buffer areas.  (Yes, I see the Todo at the beginning of syntax.el)
Or do I miss something?

The most prominent call of `syntax-propertize' is inside font-lock,
where the `font-lock-syntax-table' is active.  But there are also many
valid calls of this function (most via `syntax-ppss') where the standard
(syntax-table) is active.  (And there are missing calls - hello imenu.el)

What does this mean?  To be consistent, ...

 * Solution 1: the font-lock syntax table must not differ too much from
   the normal syntax table, i.e., the function in
   syntax-propertize-function should behave the same.  If so, it should
   be probably documented.

 * Solution 2: there is a local variable for an extra syntax table for

Any other ideas?

With Solution 1, it would be excellent if the (nth 9 ppss),
parse-partial-sexp, would be made official.  Otherwise, the multi-mode
check in antlr-mode.el (are we in the action of a grammar?) could not
rely on (nth 0 ppss) anymore...

- Christoph

reply via email to

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