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

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

[nongnu] elpa/rainbow-delimiters 5a56248229 101/188: Pass the variable s


From: ELPA Syncer
Subject: [nongnu] elpa/rainbow-delimiters 5a56248229 101/188: Pass the variable symbol to rainbow-delimiters-apply-color directly.
Date: Sat, 1 Jan 2022 00:58:56 -0500 (EST)

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

    Pass the variable symbol to rainbow-delimiters-apply-color directly.
    
    This means we do one concat and intern-soft less on every highlighted
    delimiter, yielding an easy ~10% speed gain and less GC traffic.
---
 rainbow-delimiters.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 6d9ed3be9b..eb59142ce2 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -452,13 +452,13 @@ Returns t if char at loc meets one of the following 
conditions:
 (defun rainbow-delimiters-apply-color (delim depth loc match)
   "Apply color for DEPTH to DELIM at LOC following user settings.
 
-DELIM is a string specifying delimiter type.
+DELIM is a symbol of the variable specifying whether to highlight this 
delimiter
+type.
 DEPTH is the delimiter depth, or corresponding face # if colors are repeating.
 LOC is location of character (delimiter) to be colorized.
 MATCH is nil iff it's a mismatched closing delimiter."
   ;; Ensure user has enabled highlighting of this delimiter type.
-  (when (symbol-value (intern-soft
-                       (concat "rainbow-delimiters-highlight-" delim "s-p")))
+  (when (symbol-value delim)
     (rainbow-delimiters-propertize-delimiter loc
                                              depth
                                              match)))
@@ -469,19 +469,23 @@ MATCH is nil iff it's a mismatched closing delimiter."
   "Regex matching all opening and closing delimiters the mode highlights.")
 
 (defconst rainbow-delimiters-opening-delim-info
-  '((?\( . "paren") (?\{ . "brace") (?\[ . "bracket"))
+  '((?\( . rainbow-delimiters-highlight-parens-p)
+    (?\{ . rainbow-delimiters-highlight-braces-p)
+    (?\[ . rainbow-delimiters-highlight-brackets-p))
   "Open delimiter information: list of (DELIMITER . TYPE).
 
 DELIMITER is the opening delimiter.
-TYPE is the delimiter type string for `rainbow-delimiters-apply-color'.")
+TYPE is the delimiter type for `rainbow-delimiters-apply-color'.")
 
 (defconst rainbow-delimiters-closing-delim-info
-  '((?\) ?\( . "paren") (?\} ?\{ . "brace") (?\] ?\[ . "bracket"))
+  '((?\) ?\( . rainbow-delimiters-highlight-parens-p)
+    (?\} ?\{ . rainbow-delimiters-highlight-braces-p)
+    (?\] ?\[ . rainbow-delimiters-highlight-brackets-p))
   "Closing delimiter information: list of (DELIMITER OPENING . TYPE).
 
 DELIMITER is the closing delimiter.
 OPENING is the corresponding opening delimiter.
-TYPE is the delimiter type string for `rainbow-delimiters-apply-color'.")
+TYPE is the delimiter type for `rainbow-delimiters-apply-color'.")
 
 ;; Main function called by font-lock.
 (defun rainbow-delimiters-propertize (end)



reply via email to

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