[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters f116221d42 076/188: Simplify the logic
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters f116221d42 076/188: Simplify the logic in rainbow-delimiters-propertize a little... |
Date: |
Sat, 1 Jan 2022 00:58:54 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit f116221d42c25e8b18d7b08dcc35c679fe251667
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Simplify the logic in rainbow-delimiters-propertize a little...
...by using the delimiter position returned by match-beginning instead of
moving the point to the delimiter.
---
rainbow-delimiters.el | 49 +++++++++++++++++++++++--------------------------
1 file changed, 23 insertions(+), 26 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index d4b3984cbf..0d229b44a1 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -472,33 +472,30 @@ Used by font-lock for dynamic highlighting."
(let ((depth (rainbow-delimiters-depth (point))))
(while (and (< (point) end)
(re-search-forward rainbow-delimiters-delim-regex end t))
- (backward-char) ; re-search-forward places point after delim; go
back.
- (let ((ppss (rainbow-delimiters-syntax-ppss (point))))
- (unless (rainbow-delimiters-char-ineligible-p (point) ppss)
- (let* ((delim (char-after (point)))
- (opening-delim-info
- (assq delim rainbow-delimiters-opening-delim-info)))
- (if opening-delim-info
- (progn
- (setq depth (1+ depth))
- (rainbow-delimiters-apply-color (cdr
opening-delim-info)
+ (let ((delim-pos (match-beginning 0)))
+ (let ((ppss (rainbow-delimiters-syntax-ppss delim-pos)))
+ (unless (rainbow-delimiters-char-ineligible-p delim-pos ppss)
+ (let* ((delim (char-after delim-pos))
+ (opening-delim-info
+ (assq delim rainbow-delimiters-opening-delim-info)))
+ (if opening-delim-info
+ (progn
+ (setq depth (1+ depth))
+ (rainbow-delimiters-apply-color (cdr
opening-delim-info)
+ depth
+ delim-pos
+ t))
+ ;; Not an opening delimiters, so it's a closing
delimiter.
+ (let ((closing-delim-info
+ (assq delim
rainbow-delimiters-closing-delim-info))
+ (matching-opening-delim (char-after (nth 1 ppss))))
+ (rainbow-delimiters-apply-color (nthcdr 2
closing-delim-info)
depth
- (point)
- t))
- ;; Not an opening delimiters, so it's a closing delimiter.
- (let ((closing-delim-info
- (assq delim rainbow-delimiters-closing-delim-info))
- (matching-opening-delim (char-after (nth 1 ppss))))
- (rainbow-delimiters-apply-color (nthcdr 2
closing-delim-info)
- depth
- (point)
- (= (nth 1
closing-delim-info)
-
matching-opening-delim))
- (setq depth (or (and (<= depth 0) 0) ; unmatched delim
- (1- depth))))))))
- ;; Move past delimiter so re-search-forward doesn't pick it up
- ;; again.
- (forward-char))))))
+ delim-pos
+ (= (nth 1
closing-delim-info)
+
matching-opening-delim))
+ (setq depth (or (and (<= depth 0) 0) ; unmatched delim
+ (1- depth))))))))))))))
;; We already fontified the delimiters, tell font-lock there's nothing more
;; to do.
nil)
- [nongnu] elpa/rainbow-delimiters 36df2e014c 067/188: Add code to highlight mismatched closing delimiters., (continued)
- [nongnu] elpa/rainbow-delimiters 36df2e014c 067/188: Add code to highlight mismatched closing delimiters., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters c4c127992a 071/188: Use font-lock instead of jit-lock., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 4144a75120 070/188: Add lisp-interaction-mode to rainbow-delimiters-escaped-char-predicate-list., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 447293003b 069/188: Highlight correctly even in presence of these evil 'intangible' properties., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters f73763583c 077/188: Remove unneeded save-excursion., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters edf59bad7f 165/188: Move the usage instructions from installation to commentary., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 352b4f2bfe 177/188: No need to set inhibit-point-motion-hooks, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters b316b7f49d 130/188: Make the MELPA Stable link actually point at MELPA Stable., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 8012604ea9 132/188: Add maintainership information., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters fb54c05ba0 095/188: Don't enable in special RefTeX modes, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters f116221d42 076/188: Simplify the logic in rainbow-delimiters-propertize a little...,
ELPA Syncer <=
- [nongnu] elpa/rainbow-delimiters 6df71dba8f 091/188: Release version 1.3.11., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 5459aa4c6a 102/188: Simplify rainbow-delimiters-delim-regex., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 756fd642fa 103/188: Release version 1.3.12., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 3143de1136 105/188: Update the readme., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters ccd68b7eb8 107/188: Replace a generalized push with setcdr+cons+cdr., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 3e538315ae 125/188: Point URLs to the new address., ELPA Syncer, 2022/01/01
- [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