[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters a802a6c823 156/188: Refactor the code,
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters a802a6c823 156/188: Refactor the code, no functional changes. |
Date: |
Sat, 1 Jan 2022 00:59:01 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit a802a6c823f7101ab10f9e060a4fdac5c5ffc170
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Refactor the code, no functional changes.
Use cond instead of unless + if to reduce indentation, extract a common
subexpression to a variable, introduce a variable so a multiline function
call can be written in a single line.
---
rainbow-delimiters.el | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 6be845f1e1..837407488c 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -229,22 +229,20 @@ Used by font-lock for dynamic highlighting."
(setq ppss (save-excursion
(parse-partial-sexp last-ppss-pos delim-pos nil nil
ppss)))
(setq last-ppss-pos delim-pos)
- (unless (rainbow-delimiters--char-ineligible-p delim-pos ppss (car
delim-syntax))
- (if (= 4 (logand #xFFFF (car delim-syntax)))
- (progn
- (setq depth (1+ depth))
- (rainbow-delimiters--apply-color delim-pos
- depth
- t))
+ (let ((delim-syntax-code (car delim-syntax)))
+ (cond
+ ((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))
+ (t
;; Not an opening delimiter, so it's a closing delimiter.
- (let ((matching-opening-delim (char-after (nth 1 ppss))))
- (rainbow-delimiters--apply-color delim-pos
- depth
- (eq (cdr delim-syntax)
- matching-opening-delim))
+ (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)))))))))
+ (setq depth (max 0 (1- depth))))))))))
;; We already fontified the delimiters, tell font-lock there's nothing more
;; to do.
nil)
- [nongnu] elpa/rainbow-delimiters 845e681fae 135/188: Use lexical-binding., (continued)
- [nongnu] elpa/rainbow-delimiters 845e681fae 135/188: Use lexical-binding., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters d723eb0a8c 134/188: In the C++ template syntax test, remove some text properties., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 039e9345c5 136/188: Document why there's no Emacs 24 requirement., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 115173b2eb 142/188: Rename README.markdown to README.md., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters e50e4787b4 144/188: Turn rainbow-delimiters-max-face-count into a defcustom., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 8b94fc0100 146/188: Make rainbow-delimiters-faces reachable from (customize-group 'faces)., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 82952aa34a 148/188: Test for blacklisting right before highlighting the delimiter., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters ef33129a0a 150/188: Treat byte compilation warnings as test suite failures., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters ab79aec8f8 153/188: Simplify the handling of escaped delimiters., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 402a9e8e04 152/188: Treat the ? as a quote character only when it starts a symbol., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters a802a6c823 156/188: Refactor the code, no functional changes.,
ELPA Syncer <=
- [nongnu] elpa/rainbow-delimiters 4bac5ce118 158/188: Don't flush the syntax-ppss cache unless necessary., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 9d23157002 160/188: Simplify the way we determine whether to flush syntax-ppss cache., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters cc829473be 170/188: Deprecate rainbow-delimiters-delimiter-blacklist., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters a4005ac963 162/188: Remove more useless comments., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters e75a4b18e9 159/188: Remove unneeded with-no-warnings., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 153284f304 168/188: Fix a typo., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 27d21f278b 167/188: Rephrase the header line description., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters a695c0f3b9 183/188: Use GitHub workflows for CI, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 9a644d9e42 178/188: Pass -y to apt-get install, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters f43d48a246 186/188: Widen before propertizing if under mmm-mode, ELPA Syncer, 2022/01/01