Variable: syntax-propertize-function

syntax-propertize-function is a variable defined in syntax.el.gz.

Documentation

Mode-specific function to apply syntax-table text properties.

It is the work horse of syntax-propertize, which is called by things like Font-Lock and indentation.

It is given two arguments, START and END: the start and end of the text to which syntax-table might need to be applied. Major modes can use this to override the buffer's syntax table for special syntactic constructs that cannot be handled just by the buffer's syntax-table.

The specified function may call syntax-ppss on any position before END, but if it calls syntax-ppss on some position and later modifies the buffer on some earlier position, then it is its responsibility to call syntax-ppss-flush-cache to flush the now obsolete ppss info from the cache.

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.

View in manual

Probably introduced at or before Emacs version 24.1.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/syntax.el.gz
;;; Applying syntax-table properties where needed.

(defvar syntax-propertize-function nil
  ;; Rather than a -functions hook, this is a -function because it's easier
  ;; to do a single scan than several scans: with multiple scans, one cannot
  ;; assume that the text before point has been propertized, so syntax-ppss
  ;; gives unreliable results (and stores them in its cache to boot, so we'd
  ;; have to flush that cache between each function, and we couldn't use
  ;; syntax-ppss-flush-cache since that would not only flush the cache but also
  ;; reset syntax-propertize--done which should not be done in this case).
  "Mode-specific function to apply `syntax-table' text properties.
It is the work horse of `syntax-propertize', which is called by things like
Font-Lock and indentation.

It is given two arguments, START and END: the start and end of the text to
which `syntax-table' might need to be applied.  Major modes can use this to
override the buffer's syntax table for special syntactic constructs that
cannot be handled just by the buffer's syntax-table.

The specified function may call `syntax-ppss' on any position
before END, but if it calls `syntax-ppss' on some
position and later modifies the buffer on some earlier position,
then it is its responsibility to call `syntax-ppss-flush-cache' to flush
the now obsolete ppss info from the cache.

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.")