Add doc to syntax-propertize-function saying it must do a 100% job

and cannot be combined with other ways of applying syntax-table text
properties.

* lisp/emacs-lisp/syntax.el (syntax-propertize-function): Amend doc string.

* doc/lispref/syntax.texi (Syntax Properties): Amend the description of the
variable.
This commit is contained in:
Alan Mackenzie 2020-09-19 16:50:27 +00:00
parent fcd599bbea
commit fd1fe1e1ec
2 changed files with 15 additions and 1 deletions

View file

@ -575,6 +575,15 @@ position before @var{end}. However, it should not call
@code{syntax-ppss-flush-cache}; so, it is not allowed to call
@code{syntax-ppss} on some position and later modify the buffer at an
earlier position.
@strong{Caution:} When this variable is non-@code{nil}, Emacs removes
@code{syntax-table} text properties arbitrarily and relies on
@code{syntax-propertize-function} to reapply them. Thus if this
facility is used at all, the function must apply @strong{all}
@code{syntax-table} text properties used by the major mode. In
particular, Modes derived from a CC Mode mode must not use this
variable, since CC Mode uses other means to apply and remove these
text properties.
@end defvar
@defvar syntax-propertize-extend-region-functions

View file

@ -65,7 +65,12 @@ cannot be handled just by the buffer's syntax-table.
The specified function may call `syntax-ppss' on any position
before END, but it should not call `syntax-ppss-flush-cache',
which means that it should not call `syntax-ppss' on some
position and later modify the buffer on some earlier position.")
position and later modify the buffer on some earlier position.
Note: When this variable is a function, it must apply _all_ the
`syntax-table' properties needed in the given text interval.
Using both this function and other means to apply these
properties won't work properly.")
(defvar syntax-propertize-chunk-size 500)