[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters ed5dd72f79 119/188: Restore the ability
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters ed5dd72f79 119/188: Restore the ability to disable the highlighting of selected delimiters. |
Date: |
Sat, 1 Jan 2022 00:58:58 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit ed5dd72f7949caebe5ad8f641555b1924f130715
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Restore the ability to disable the highlighting of selected delimiters.
Please note that the new way is not compatible with the old way.
---
rainbow-delimiters-test.el | 11 ++-----
rainbow-delimiters.el | 71 +++++++++++++---------------------------------
2 files changed, 22 insertions(+), 60 deletions(-)
diff --git a/rainbow-delimiters-test.el b/rainbow-delimiters-test.el
index 3fd02a1087..2cf27c9d74 100644
--- a/rainbow-delimiters-test.el
+++ b/rainbow-delimiters-test.el
@@ -184,14 +184,9 @@
0 1 (face (rainbow-delimiters-depth-1-face))
1 2 (face (rainbow-delimiters-mismatched-face))))))))
-(defmacro doesnt-highlight-disabled-delimiters (name opening)
- `(ert-deftest ,(intern (format "doesnt-highlight-disabled-%s" name)) ()
- (let ((,(intern (format "rainbow-delimiters-highlight-%s-p" name)) nil))
- (should-do-nothing 'text-mode ,(format "%c" opening)))))
-
-(doesnt-highlight-disabled-delimiters "parens" ?\()
-(doesnt-highlight-disabled-delimiters "brackets" ?\[)
-(doesnt-highlight-disabled-delimiters "braces" ?\{)
+(ert-deftest doesnt-highlighlight-disabled-delimiters ()
+ (let ((rainbow-delimiters-delimiter-blacklist '(?\( ?\))))
+ (should-do-nothing 'text-mode "(((())))")))
(ert-deftest doesnt-highlight-escaped-delimiters ()
(should-do-nothing 'emacs-lisp-mode "?\("))
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index a7d113f7be..a223516677 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -106,44 +106,15 @@ When depth exceeds innermost defined face, colors cycle
back through."
:tag "Color Scheme"
:group 'rainbow-delimiters
:link '(custom-group-link "rainbow-delimiters")
- :link '(custom-group-link :tag "Toggle Delimiters"
"rainbow-delimiters-toggle-delimiter-highlighting")
:prefix "rainbow-delimiters-")
-;; Choose which delimiters you want to highlight in your preferred language:
+(defcustom rainbow-delimiters-delimiter-blacklist '()
+ "Disable highlighting of selected delimiters.
-(defgroup rainbow-delimiters-toggle-delimiter-highlighting nil
- "Choose which delimiters to highlight."
- :tag "Toggle Delimiters"
- :group 'rainbow-delimiters
- :link '(custom-group-link "rainbow-delimiters")
- :link '(custom-group-link :tag "Color Scheme" "rainbow-delimiters-faces"))
-
-(defcustom rainbow-delimiters-highlight-parens-p t
- "Enable highlighting of nested parentheses -- ().
-
-Non-nil (default) enables highlighting of parentheses.
-Nil disables parentheses highlighting."
- :tag "Highlight Parentheses?"
- :type 'boolean
- :group 'rainbow-delimiters-toggle-delimiter-highlighting)
-
-(defcustom rainbow-delimiters-highlight-brackets-p t
- "Enable highlighting of nested brackets -- [].
-
-Non-nil (default) enables highlighting of brackets.
-Nil disables bracket highlighting."
- :tag "Highlight Brackets?"
- :type 'boolean
- :group 'rainbow-delimiters-toggle-delimiter-highlighting)
-
-(defcustom rainbow-delimiters-highlight-braces-p t
- "Enable highlighting of nested braces -- {}.
-
-Non-nil (default) enables highlighting of braces.
-Nil disables brace highlighting."
- :tag "Highlight Braces?"
- :type 'boolean
- :group 'rainbow-delimiters-toggle-delimiter-highlighting)
+Delimiters in this list are not highlighted."
+ :tag "Delimiter Blacklist"
+ :type '(repeat character)
+ :group 'rainbow-delimiters)
;;; Faces:
@@ -368,8 +339,9 @@ MATCH is nil iff it's a mismatched closing delimiter."
(eq (char-before loc) ?\\))
(defun rainbow-delimiters--char-ineligible-p (loc ppss delim-syntax-code)
- "Return t if char at LOC should be skipped, e.g. if inside a comment.
-PPSS should be the `parse-partial-sexp' state at LOC.
+ "Return t if char at LOC should not be highlighted.
+PPSS is the `parse-partial-sexp' state at LOC.
+DELIM-SYNTAX-CODE is the `car' of a raw syntax descriptor at LOC.
Returns t if char at loc meets one of the following conditions:
- Inside a string.
@@ -392,19 +364,16 @@ Returns t if char at loc meets one of the following
conditions:
(when rainbow-delimiters-escaped-char-predicate
(funcall rainbow-delimiters-escaped-char-predicate loc))))
-(defun rainbow-delimiters--apply-color (delim depth loc match)
- "Apply color for DEPTH to DELIM at LOC following user settings.
+(defun rainbow-delimiters--apply-color (depth loc match)
+ "Apply color to the delimiter following user settings.
-DELIM is a symbol of the variable specifying whether to highlight this
delimiter
-type.
-DEPTH is the delimiter depth, or corresponding face # if colors are repeating.
-LOC is location of character (delimiter) to be colorized.
+DEPTH is the delimiter depth.
+LOC is the location of delimiters to be highlighted.
MATCH is nil iff it's a mismatched closing delimiter."
- ;; Ensure user has enabled highlighting of this delimiter type.
- ;; (when (symbol-value delim)
- (rainbow-delimiters--propertize-delimiter loc
- depth
- match));; )
+ (unless (memq (char-after loc) rainbow-delimiters-delimiter-blacklist)
+ (rainbow-delimiters--propertize-delimiter loc
+ depth
+ match)))
;;; Font-Lock functionality
@@ -434,14 +403,12 @@ Used by font-lock for dynamic highlighting."
(if (= 4 (logand #xFFFF (car delim-syntax)))
(progn
(setq depth (1+ depth))
- (rainbow-delimiters--apply-color nil
- depth
+ (rainbow-delimiters--apply-color depth
delim-pos
t))
;; Not an opening delimiter, so it's a closing delimiter.
(let ((matching-opening-delim (char-after (nth 1 ppss))))
- (rainbow-delimiters--apply-color nil
- depth
+ (rainbow-delimiters--apply-color depth
delim-pos
(eq (cdr delim-syntax)
matching-opening-delim))
- [nongnu] elpa/rainbow-delimiters e2a67de8e7 097/188: Deprecate global-rainbow-delimiters-mode., (continued)
- [nongnu] elpa/rainbow-delimiters e2a67de8e7 097/188: Deprecate global-rainbow-delimiters-mode., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 29e7bfd8e4 098/188: Remove global-rainbow-delimiters-mode from installation instructions., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 4cc4d38479 099/188: Remove global-rainbow-delimiters-mode., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters d35b992378 106/188: Don't error when highlighting an unmatched closing delimiter., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters e48b7bf746 104/188: Merge pull request #41 from jlr/no-global, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters f2404ef0bf 108/188: Remove dead code., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters cf61a3aee6 109/188: Use double hyphen to indicate internal symbols., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 2cde18809f 112/188: Use the syntax table to determine if a delimiters starts a comment., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 513bb785eb 114/188: Update authorship, package metadata, and URLs., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 4699fd94c8 115/188: Release version 1.3.13., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters ed5dd72f79 119/188: Restore the ability to disable the highlighting of selected delimiters.,
ELPA Syncer <=
- [nongnu] elpa/rainbow-delimiters f5679e9040 120/188: Simplify two ifs by using max in their stead., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters b32fedb455 121/188: Remove an unneeded condition., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters d8de0c6954 122/188: Kill rainbow-delimiters--parse-partial-sexp-cache when turning off., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters f50a4ae177 123/188: Use `syntax-ppss` instead of our own implementation., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 50551159a7 124/188: Move rainbow-delimiters--mode-turn-{on, off} back into rainbow-delimiters-mode., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 44bd65920e 127/188: Remove the TODO list from rainbow-delimiters.el., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 25ceded842 128/188: Add MELPA and build status badges to the readme., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters df63c842a3 131/188: Update the customization instructions., ELPA Syncer, 2022/01/01
- [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