[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters f91b36bad7 157/188: Use the depth from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters f91b36bad7 157/188: Use the depth from parse-partial-sexp directly |
Date: |
Sat, 1 Jan 2022 00:59:01 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit f91b36bad7685bdced8ab423772f9f634bdbca1b
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Use the depth from parse-partial-sexp directly
instead of tracking it on our own.
This does change the observable behavior of highlighting when there are
many unmatched closing delimiters, but the old behavior was
non-contractual and very dependent on the value of jit-lock-chunk-size.
---
rainbow-delimiters.el | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 837407488c..548516ca96 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -218,11 +218,8 @@ Returns t if char at loc meets one of the following
conditions:
Used by font-lock for dynamic highlighting."
(let* ((inhibit-point-motion-hooks t)
- ;; Point can be anywhere in buffer; determine the nesting depth at
point.
(last-ppss-pos (point))
- (ppss (syntax-ppss))
- ;; Ignore negative depths created by unmatched closing delimiters.
- (depth (max 0 (nth 0 ppss))))
+ (ppss (syntax-ppss)))
(while (re-search-forward rainbow-delimiters--delim-regex end t)
(let* ((delim-pos (match-beginning 0))
(delim-syntax (syntax-after delim-pos)))
@@ -234,15 +231,13 @@ Used by font-lock for dynamic highlighting."
((rainbow-delimiters--char-ineligible-p delim-pos ppss
delim-syntax-code)
nil)
((= 4 (logand #xFFFF delim-syntax-code))
- (setq depth (1+ depth))
- (rainbow-delimiters--apply-color delim-pos depth t))
+ ;; The (1+ ...) is needed because `parse-partial-sexp' returns the
+ ;; depth at the opening delimiter, not in the block being started.
+ (rainbow-delimiters--apply-color delim-pos (1+ (nth 0 ppss)) t))
(t
;; Not an opening delimiter, so it's a closing delimiter.
(let ((matches-p (eq (cdr delim-syntax) (char-after (nth 1
ppss)))))
- (rainbow-delimiters--apply-color delim-pos depth matches-p)
- ;; Don't let `depth' go negative, even if there's an unmatched
- ;; delimiter.
- (setq depth (max 0 (1- depth))))))))))
+ (rainbow-delimiters--apply-color delim-pos (nth 0 ppss)
matches-p))))))))
;; We already fontified the delimiters, tell font-lock there's nothing more
;; to do.
nil)
- [nongnu] elpa/rainbow-delimiters 9ee4a86d47 133/188: Run the test suite under Emacs 23., (continued)
- [nongnu] elpa/rainbow-delimiters 9ee4a86d47 133/188: Run the test suite under Emacs 23., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 5eeddfb2d6 137/188: Test for blacklisting in rainbow-delimiters--char-ineligible-p., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 41546fa1f2 129/188: Fix a typo in the readme., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters daae2c22a6 141/188: Really make Emacs 23 tests less verbose., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 8a2c0374b0 143/188: Use a macro to generate face definitions., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 5435305789 145/188: Move all variables to 'rainbow-delimiters' group., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 798af906df 147/188: Add a test checking if blacklisted delims still contribute to depth., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 58f17c9c4d 149/188: The faces should really use foreground colors., ELPA Syncer, 2022/01/01
- [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 <=
- [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, 2022/01/01
- [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