[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters ab79aec8f8 153/188: Simplify the handli
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters ab79aec8f8 153/188: Simplify the handling of escaped delimiters. |
Date: |
Sat, 1 Jan 2022 00:59:01 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit ab79aec8f8a81091357468728fe4f43d8845b4c3
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>
Simplify the handling of escaped delimiters.
Position 5 of the list returned by syntax-ppss is non-nil iff
the character is escaped according to the syntax table. Use it to
remove the special case for Lisps other than Emacs Lisp.
The special case for Emacs Lisp is still there, to catch ?(.
This form, however, is deprecated, confuses many a minor mode and
confuses the emacs-lisp-mode indentation engine, so the special case
will likely go away soon, too.
---
rainbow-delimiters.el | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index a81953eca9..f6d7a7c843 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -191,29 +191,19 @@ The delimiter is not highlighted if it's a blacklisted
delimiter."
'((emacs-lisp-mode . rainbow-delimiters--escaped-char-predicate-emacs-lisp)
(lisp-interaction-mode .
rainbow-delimiters--escaped-char-predicate-emacs-lisp)
(inferior-emacs-lisp-mode .
rainbow-delimiters--escaped-char-predicate-emacs-lisp)
- (lisp-mode . rainbow-delimiters--escaped-char-predicate-lisp)
- (scheme-mode . rainbow-delimiters--escaped-char-predicate-lisp)
- (clojure-mode . rainbow-delimiters--escaped-char-predicate-lisp)
- (inferior-scheme-mode . rainbow-delimiters--escaped-char-predicate-lisp)
))
(defun rainbow-delimiters--escaped-char-predicate-emacs-lisp (loc)
"Non-nil iff the character at LOC is escaped as per Emacs Lisp rules."
- (or (and (eq (char-before loc) ?\?) ; e.g. ?) - deprecated, but people use it
- (not (and (eq (char-before (1- loc)) ?\\) ; special case: ignore ?\?
- (eq (char-before (- loc 2)) ?\?)))
- ;; Treat the ? as a quote character only when it starts a symbol, so
- ;; we're not confused by (foo?), which is a valid function call.
- (let ((inhibit-changing-match-data t))
- (save-excursion
- (goto-char (1- loc))
- (looking-at "\\_<"))))
- (and (eq (char-before loc) ?\\) ; escaped char, e.g. ?\) - not counted
- (eq (char-before (1- loc)) ?\?))))
-
-(defun rainbow-delimiters--escaped-char-predicate-lisp (loc)
- "Non-nil iff the character at LOC is escaped as per some generic Lisp rules."
- (eq (char-before loc) ?\\))
+ (and (eq (char-before loc) ?\?) ; e.g. ?) - deprecated, but people use it
+ (not (and (eq (char-before (1- loc)) ?\\) ; special case: ignore ?\?
+ (eq (char-before (- loc 2)) ?\?)))
+ ;; Treat the ? as a quote character only when it starts a symbol, so
+ ;; we're not confused by (foo?), which is a valid function call.
+ (let ((inhibit-changing-match-data t))
+ (save-excursion
+ (goto-char (1- loc))
+ (looking-at "\\_<")))))
(defun rainbow-delimiters--char-ineligible-p (loc ppss delim-syntax-code)
"Return t if char at LOC should not be highlighted.
@@ -227,6 +217,7 @@ Returns t if char at loc meets one of the following
conditions:
(or
(nth 3 ppss) ; inside string?
(nth 4 ppss) ; inside comment?
+ (nth 5 ppss) ; escaped according to the syntax table?
;; Note: no need to consider single-char openers, they're already handled
;; by looking at ppss.
(cond
- [nongnu] elpa/rainbow-delimiters 25ceded842 128/188: Add MELPA and build status badges to the readme., (continued)
- [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
- [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 <=
- [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, 2022/01/01
- [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