Function: electric-pair--with-uncached-syntax

electric-pair--with-uncached-syntax is a macro defined in elec-pair.el.gz.

Signature

(electric-pair--with-uncached-syntax (TABLE &optional START) &rest BODY)

Documentation

Like with-syntax-table, but flush the syntax-ppss cache afterwards.

Use this instead of (with-syntax-table TABLE BODY) when BODY contains code which may update the syntax-ppss cache. This includes calling parse-partial-sexp and any sexp-based movement functions when parse-sexp-lookup-properties is non-nil. The cache is flushed from position START, defaulting to point.

Source Code

;; Defined in /usr/src/emacs/lisp/elec-pair.el.gz
(cl-defmacro electric-pair--with-uncached-syntax ((table &optional start) &rest body)
  "Like `with-syntax-table', but flush the `syntax-ppss' cache afterwards.
Use this instead of (with-syntax-table TABLE BODY) when BODY
contains code which may update the `syntax-ppss' cache.  This
includes calling `parse-partial-sexp' and any sexp-based movement
functions when `parse-sexp-lookup-properties' is non-nil.  The
cache is flushed from position START, defaulting to point."
  (declare (debug ((form &optional form) body)) (indent 1))
  (let ((start-var (make-symbol "start")))
    `(let ((syntax-propertize-function #'ignore)
           (,start-var ,(or start '(point))))
       (unwind-protect
           (with-syntax-table ,table
             ,@body)
         (syntax-ppss-flush-cache ,start-var)))))