[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters 506fef695f 049/188: Allow the user to d
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters 506fef695f 049/188: Allow the user to define the number of faces used only for the outermost level. |
Date: |
Sat, 1 Jan 2022 00:58:51 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit 506fef695f65605b2c0a8b4ee8a2e90f264f9e1e
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Allow the user to define the number of faces used only for the outermost
level.
Fixes #19.
---
rainbow-delimiters.el | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index b3f614651b..e11336fb5d 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -283,6 +283,11 @@ Nil disables brace highlighting."
Determines depth at which to cycle through faces again.")
+(defvar rainbow-delimiters-outermost-only-face-count 0
+ "Number of faces to be used only for N outermost delimiter levels.
+
+This should be smaller than `rainbow-delimiters-max-face-count'.")
+
;;; Face utility functions
(defsubst rainbow-delimiters-depth-face (depth)
@@ -291,22 +296,19 @@ Determines depth at which to cycle through faces again.")
For example: 'rainbow-delimiters-depth-1-face'."
(intern-soft
(concat "rainbow-delimiters-depth-"
- (number-to-string
- (or
- ;; Our nesting depth has a face defined for it.
- (and (< depth rainbow-delimiters-max-face-count)
- depth)
- ;; Deeper than # of defined faces; cycle back through to beginning.
- ;; Depth 1 face is only applied to the outermost delimiter pair.
- ;; Cycles infinitely through faces 2-9.
- (let ((cycled-depth (mod depth rainbow-delimiters-max-face-count)))
- (if (/= cycled-depth 0)
- ;; Return face # that corresponds to current nesting level.
- (mod depth rainbow-delimiters-max-face-count)
- ;; Special case: depth divides evenly into max, correct face #
is max.
- rainbow-delimiters-max-face-count))))
- "-face")))
-
+ (number-to-string
+ (or
+ ;; Our nesting depth has a face defined for it.
+ (and (<= depth rainbow-delimiters-max-face-count)
+ depth)
+ ;; Deeper than # of defined faces; cycle back through to
+ ;; `rainbow-delimiters-outermost-only-face-count' + 1.
+ ;; Return face # that corresponds to current nesting level.
+ (+ 1 rainbow-delimiters-outermost-only-face-count
+ (mod (- depth rainbow-delimiters-max-face-count 1)
+ (- rainbow-delimiters-max-face-count
+ rainbow-delimiters-outermost-only-face-count)))))
+ "-face")))
;;; Nesting level
- [nongnu] elpa/rainbow-delimiters d38744e945 045/188: Remove middle initial from my name., (continued)
- [nongnu] elpa/rainbow-delimiters d38744e945 045/188: Remove middle initial from my name., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 59d8d64a84 033/188: Merge pull request #9 from To1ne/patch-1, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters df383f86f7 074/188: Clean up comments and whitespace., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 5a7d0131f8 050/188: README.markdown: minor wording changes., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 164b55be80 036/188: Double the speed of main jit-lock highlighting fn (see commit msg for benchmarks); eliminate bottleneck in large files., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 1d71bda98c 035/188: Rename syntax-table functions to be clearer., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 6345c1fa4b 040/188: Release rainbow-delimiters version 1.3.4 (2012-04-27)., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 9d0683d77d 034/188: 6-15x Speed improvement by enhancing two key functions, see commit message for benchmarks., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 89b748e401 065/188: Make rainbow-delimiters-outermost-only-face-count customizable., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 4eae4bc56f 068/188: Reduce the amount of copy and paste in rainbow-delimiters-propertize-region., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 506fef695f 049/188: Allow the user to define the number of faces used only for the outermost level.,
ELPA Syncer <=
- [nongnu] elpa/rainbow-delimiters 5ab3135986 061/188: Fix a bug that caused (rainbow-delimiters-syntax-ppss 1) to return nil., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 43b02d2d20 075/188: Rename rainbow-delimiters-keywords., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters a095a77dc9 066/188: Correct the prefix of the rainbow-delimiters-faces group., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters d7946fdf94 078/188: Fix a typo in a comment., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 14e0f971f6 079/188: Call font-lock-{flush, fontify-buffer} only when font-lock-mode is on., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters b3f87cfe99 072/188: Highlight delimiters even in already highlighted text., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters a37d19b415 082/188: Add a comment explaining the previous change., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 36efff58a8 081/188: Don't highlight delimiters inside comments starting with two chars., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 24f6c5767e 083/188: Release version 1.3.8., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 35eace73ca 084/188: Reuse parse-partial-sexp state in rainbow-delimiters-propertize., ELPA Syncer, 2022/01/01