emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/rainbow-delimiters 9d23157002 160/188: Simplify the way we


From: ELPA Syncer
Subject: [nongnu] elpa/rainbow-delimiters 9d23157002 160/188: Simplify the way we determine whether to flush syntax-ppss cache.
Date: Sat, 1 Jan 2022 00:59:01 -0500 (EST)

branch: elpa/rainbow-delimiters
commit 9d231570024592fd21eb7c00bc17c8d3dd6952ec
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>

    Simplify the way we determine whether to flush syntax-ppss cache.
---
 rainbow-delimiters.el | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 854449a2c0..c48cffbaa5 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -255,22 +255,18 @@ Used by font-lock for dynamic highlighting."
   (when rainbow-delimiters-mode
     (font-lock-add-keywords nil rainbow-delimiters--font-lock-keywords 'append)
     (set (make-local-variable 'jit-lock-contextually) t)
-    (let ((flush-needed nil))
-      (when syntax-begin-function
-        ;; `syntax-begin-function' may break the assumption we rely on that
-        ;; `syntax-ppss' is exactly equivalent to `parse-partial-sexp' from
-        ;; `point-min'. Just don't use it, the performance hit should be
-        ;; negligible.
-        (setq flush-needed t)
-        (set (make-local-variable 'syntax-begin-function) nil))
-      ;; Obsolete equivalent of `syntax-begin-function'.
-      (when (bound-and-true-p font-lock-beginning-of-syntax-function)
-        (setq flush-needed t)
-        (set (make-local-variable 'font-lock-beginning-of-syntax-function) 
nil))
-      (when flush-needed
-        ;; We modified `syntax-begin-function', so flush the cache to avoid
-        ;; getting cached values that used the old value.
-        (syntax-ppss-flush-cache 0))))
+    (when (or syntax-begin-function
+              (bound-and-true-p font-lock-beginning-of-syntax-function))
+      ;; We're going to modify `syntax-begin-function', so flush the cache to
+      ;; avoid getting cached values that used the old value.
+      (syntax-ppss-flush-cache 0))
+    ;; `syntax-begin-function' may break the assumption we rely on that
+    ;; `syntax-ppss' is exactly equivalent to `parse-partial-sexp' from
+    ;; `point-min'. Just don't use it, the performance hit should be 
negligible.
+    (set (make-local-variable 'syntax-begin-function) nil)
+    ;; Obsolete equivalent of `syntax-begin-function'.
+    (when (boundp 'font-lock-beginning-of-syntax-function)
+      (set (make-local-variable 'font-lock-beginning-of-syntax-function) nil)))
   (when font-lock-mode
     (if (fboundp 'font-lock-flush)
         (font-lock-flush)



reply via email to

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