]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/syntax.el
Don’t create unnecessary marker in ‘delete-trailing-whitespace’
[gnu-emacs] / lisp / emacs-lisp / syntax.el
index c221a017f5127334ab6670f70a42b4b9e533189b..ac509b3465d40db0c37565891dc6c1536a047342 100644 (file)
@@ -272,9 +272,10 @@ Note: back-references in REGEXPs do not work."
          (cond ,@(nreverse branches))))))
 
 (defun syntax-propertize-via-font-lock (keywords)
-  "Propertize for syntax in START..END using font-lock syntax.
+  "Propertize for syntax using font-lock syntax.
 KEYWORDS obeys the format used in `font-lock-syntactic-keywords'.
-The return value is a function suitable for `syntax-propertize-function'."
+The return value is a function (with two parameters, START and
+END) suitable for `syntax-propertize-function'."
   (lambda (start end)
     (with-no-warnings
       (let ((font-lock-syntactic-keywords keywords))
@@ -283,7 +284,7 @@ The return value is a function suitable for `syntax-propertize-function'."
         (setq keywords font-lock-syntactic-keywords)))))
 
 (defun syntax-propertize (pos)
-  "Ensure that syntax-table properties are set until POS."
+  "Ensure that syntax-table properties are set until POS (a buffer point)."
   (when (< syntax-propertize--done pos)
     (if (null syntax-propertize-function)
         (setq syntax-propertize--done (max (point-max) pos))
@@ -315,6 +316,9 @@ The return value is a function suitable for `syntax-propertize-function'."
                   (unless (eq funs
                               (cdr syntax-propertize-extend-region-functions))
                     (setq funs syntax-propertize-extend-region-functions)))))
+            ;; Flush ppss cache between the original value of `start' and that
+            ;; set above by syntax-propertize-extend-region-functions.
+            (syntax-ppss-flush-cache start)
             ;; Move the limit before calling the function, so the function
             ;; can use syntax-ppss.
             (setq syntax-propertize--done end)