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

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

[nongnu] elpa/rainbow-delimiters 82952aa34a 148/188: Test for blacklisti


From: ELPA Syncer
Subject: [nongnu] elpa/rainbow-delimiters 82952aa34a 148/188: Test for blacklisting right before highlighting the delimiter.
Date: Sat, 1 Jan 2022 00:59:00 -0500 (EST)

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

    Test for blacklisting right before highlighting the delimiter.
    
    Fixes 'blacklisted-contribute-to-depth' test failure.
---
 rainbow-delimiters.el | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 90510058b2..863cdef06d 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -171,15 +171,18 @@ For example: `rainbow-delimiters-depth-1-face'."
 
 LOC is the location of the character to add text properties to.
 DEPTH is the nested depth at LOC, which determines the face to use.
-MATCH is nil iff it's a mismatched closing delimiter."
-  (let ((delim-face (cond
-                     ((<= depth 0)
-                      'rainbow-delimiters-unmatched-face)
-                     ((not match)
-                      'rainbow-delimiters-mismatched-face)
-                     (t
-                      (rainbow-delimiters--depth-face depth)))))
-    (font-lock-prepend-text-property loc (1+ loc) 'face delim-face)))
+MATCH is nil iff it's a mismatched closing delimiter.
+
+The delimiter is not highlighted if it's a blacklisted delimiter."
+  (unless (memq (char-after loc) rainbow-delimiters-delimiter-blacklist)
+    (let ((delim-face (cond
+                       ((<= depth 0)
+                        'rainbow-delimiters-unmatched-face)
+                       ((not match)
+                        'rainbow-delimiters-mismatched-face)
+                       (t
+                        (rainbow-delimiters--depth-face depth)))))
+      (font-lock-prepend-text-property loc (1+ loc) 'face delim-face))))
 
 (defvar rainbow-delimiters-escaped-char-predicate nil)
 (make-variable-buffer-local 'rainbow-delimiters-escaped-char-predicate)
@@ -214,8 +217,7 @@ DELIM-SYNTAX-CODE is the `car' of a raw syntax descriptor 
at LOC.
 Returns t if char at loc meets one of the following conditions:
 - Inside a string.
 - Inside a comment.
-- Is an escaped char, e.g. ?\)
-- Is a blacklisted character."
+- Is an escaped char, e.g. ?\)"
   (or
    (nth 3 ppss)                ; inside string?
    (nth 4 ppss)                ; inside comment?
@@ -231,8 +233,7 @@ Returns t if char at loc meets one of the following 
conditions:
     (t
      nil))
    (when rainbow-delimiters-escaped-char-predicate
-     (funcall rainbow-delimiters-escaped-char-predicate loc))
-   (memq (char-after loc) rainbow-delimiters-delimiter-blacklist)))
+     (funcall rainbow-delimiters-escaped-char-predicate loc))))
 
 (defconst rainbow-delimiters--delim-regex "\\s(\\|\\s)"
   "Regex matching all opening and closing delimiters the mode highlights.")



reply via email to

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