[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters d007f2d797 174/188: Use skip-syntax-for
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters d007f2d797 174/188: Use skip-syntax-forward instead of re-search-forward |
Date: |
Sat, 1 Jan 2022 00:59:02 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit d007f2d797cd09b3bd15622abb69ba921985181b
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Use skip-syntax-forward instead of re-search-forward
Time needed to do 1000 fontifications of rainbow-delimiters.el:
Before: 3.01 s
After: 2.25 s
---
rainbow-delimiters.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 7495d31424..ea160822db 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -215,9 +215,6 @@ Returns t if char at loc meets one of the following
conditions:
(t
nil))))
-(defconst rainbow-delimiters--delim-regex "\\s(\\|\\s)"
- "Regex matching all opening and closing delimiters the mode highlights.")
-
;; Main function called by font-lock.
(defun rainbow-delimiters--propertize (end)
"Highlight delimiters in region between point and END.
@@ -226,12 +223,15 @@ Used by font-lock for dynamic highlighting."
(let* ((inhibit-point-motion-hooks t)
(last-ppss-pos (point))
(ppss (syntax-ppss)))
- (while (re-search-forward rainbow-delimiters--delim-regex end t)
- (let* ((delim-pos (match-beginning 0))
+ (while (> end (progn (skip-syntax-forward "^()" end)
+ (point)))
+ (let* ((delim-pos (point))
(delim-syntax (syntax-after delim-pos)))
- (setq ppss (save-excursion
- (parse-partial-sexp last-ppss-pos delim-pos nil nil
ppss)))
+ (setq ppss (parse-partial-sexp last-ppss-pos delim-pos nil nil ppss))
(setq last-ppss-pos delim-pos)
+ ;; `skip-syntax-forward' leaves the point at the delimiter, move past
+ ;; it.
+ (forward-char)
(let ((delim-syntax-code (car delim-syntax)))
(cond
((rainbow-delimiters--char-ineligible-p delim-pos ppss
delim-syntax-code)
- [nongnu] elpa/rainbow-delimiters 0441e7317b 151/188: Add a better escaped delimiter test case., (continued)
- [nongnu] elpa/rainbow-delimiters 0441e7317b 151/188: Add a better escaped delimiter test case., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters b10da10248 154/188: Release version 2.0., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters f91b36bad7 157/188: Use the depth from parse-partial-sexp directly, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters ac62aa0a53 161/188: Remove useless comments., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters edd8f8624d 171/188: Kill rainbow-delimiters-delimiter-blacklist., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters a50f8f1a9c 166/188: Shorten the header line., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 9eb2dff24e 172/188: Release version 2.1., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 28438926aa 164/188: Move installation instructions before the commentary., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 5e6fbb46f9 175/188: Update copyright years, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters b4ef113712 184/188: Move the test script to root and make sure it's executable, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters d007f2d797 174/188: Use skip-syntax-forward instead of re-search-forward,
ELPA Syncer <=
- [nongnu] elpa/rainbow-delimiters 19b93892af 180/188: Inherit all rainbow-delimiters faces from a base face, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters e561cff4ab 181/188: Amended Travis build matrix, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 455bcee19c 182/188: Provide a base face for the error faces too, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters c1149daac0 173/188: Make it clear that global-rainbow-delimiters-mode is no more, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 93cd2dc873 179/188: syntax-begin-function is obsolete, so test for its existence, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 3611b101d3 139/188: Test if already highlighted text is highlighted correctly., ELPA Syncer, 2022/01/01