[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rainbow-delimiters e05dd60c12 100/188: Don't propertize if
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rainbow-delimiters e05dd60c12 100/188: Don't propertize if the syntax table is unset |
Date: |
Sat, 1 Jan 2022 00:58:56 -0500 (EST) |
branch: elpa/rainbow-delimiters
commit e05dd60c123cdc7224623fd68f18c75b486a6783
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>
Don't propertize if the syntax table is unset
`rainbow-delimiters-mode' may be restored via desktop.el. When this
happens inside an `mmm-mode' buffer, the subregion-specific values of
the syntax table will not be restored, and so
`rainbow-delimiters-syntax-table' can be nil. We handle this case by
skipping propertization if the syntax table is unset.
Closes https://github.com/purcell/emacs.d/issues/209
---
rainbow-delimiters.el | 67 ++++++++++++++++++++++++++-------------------------
1 file changed, 34 insertions(+), 33 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index cf9b7feddd..6d9ed3be9b 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -490,41 +490,42 @@ TYPE is the delimiter type string for
`rainbow-delimiters-apply-color'.")
Used by font-lock for dynamic highlighting."
(setq rainbow-delimiters-escaped-char-predicate
(cdr (assoc major-mode
rainbow-delimiters-escaped-char-predicate-list)))
- (with-syntax-table rainbow-delimiters-syntax-table
- (let ((inhibit-point-motion-hooks t))
- ;; Point can be anywhere in buffer; determine the nesting depth at point.
- (let* ((last-ppss-pos (point))
- (ppss (rainbow-delimiters-syntax-ppss last-ppss-pos))
- (depth (rainbow-delimiters-depth ppss)))
- (while (and (< (point) end)
- (re-search-forward rainbow-delimiters-delim-regex end t))
- (let ((delim-pos (match-beginning 0)))
- (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)
- (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)
+ (when rainbow-delimiters-syntax-table
+ (with-syntax-table rainbow-delimiters-syntax-table
+ (let ((inhibit-point-motion-hooks t))
+ ;; Point can be anywhere in buffer; determine the nesting depth at
point.
+ (let* ((last-ppss-pos (point))
+ (ppss (rainbow-delimiters-syntax-ppss last-ppss-pos))
+ (depth (rainbow-delimiters-depth ppss)))
+ (while (and (< (point) end)
+ (re-search-forward rainbow-delimiters-delim-regex end t))
+ (let ((delim-pos (match-beginning 0)))
+ (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)
+ (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 delimiter, 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
delim-pos
- t))
- ;; Not an opening delimiter, 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
- delim-pos
- (= (nth 1
closing-delim-info)
- matching-opening-delim))
- (setq depth (if (<= depth 0)
- 0 ; unmatched delim
- (1- depth))))))))))))
+ (= (nth 1
closing-delim-info)
+
matching-opening-delim))
+ (setq depth (if (<= 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 40c2aa5ce3 028/188: Update description and commentary at top of file., (continued)
- [nongnu] elpa/rainbow-delimiters 40c2aa5ce3 028/188: Update description and commentary at top of file., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 9c4950a283 060/188: Properly tear down the mode when changing major mode., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 75acc28109 063/188: Release version 1.3.7., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters a1cd80ee8d 073/188: Remove the changelog., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 0fa4723a9d 080/188: Add rainbow-delimiters-ignore-modes, ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters df4976a965 086/188: Release version 1.3.9., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters b85b86c0b4 088/188: Release version 1.3.10., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 49fb05303a 090/188: Use when/if instead of and/or+and., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 3a18183db3 092/188: Remove cider-repl-mode from rainbow-delimiters-ignore-modes., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 5a56248229 101/188: Pass the variable symbol to rainbow-delimiters-apply-color directly., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters e05dd60c12 100/188: Don't propertize if the syntax table is unset,
ELPA Syncer <=
- [nongnu] elpa/rainbow-delimiters d4d8f74158 110/188: Use #' to quote function names., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 575620510f 111/188: Reindent after cf61a3aee6., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 0a4e4958ed 113/188: Add a missing or in rainbow-delimiters--char-ineligible-p., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 1473fbddce 116/188: Add a test suite., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 89574443f0 117/188: Fix the Emacs 24.3-specific test failure., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 30c6a4c1bc 118/188: Use the major mode's syntax table directly., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 406ee45e7c 126/188: Rewrite the installation and usage instructions., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 7b882c9489 138/188: Merge (let … (let* …)) => (let* …)., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters f57067cda5 140/188: Make Emacs 23 tests less verbose., ELPA Syncer, 2022/01/01
- [nongnu] elpa/rainbow-delimiters 6e9e17e739 008/188: Add a 'global-rainbow-delimiters-mode' for enabling rainbow-delimiters in all buffers., ELPA Syncer, 2022/01/01