branch: elpa/rainbow-delimiters
commit 5ab3135986fc40d9fa6c51f9e093c934e4f9f31e
Author: Fanael Linithien <[email protected]>
Commit: Fanael Linithien <[email protected]>
Fix a bug that caused (rainbow-delimiters-syntax-ppss 1) to return nil.
---
rainbow-delimiters.el | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index b8ded8a84a..b4f513f52f 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -343,16 +343,18 @@ The list is ordered descending by car.")
CACHE-NEAREST-AFTER should be a list of cache entries starting at the first
entry after TO, or nil if there's no such entry.
Intermediate `parse-partial-sexp' results are added to the cache."
- (while (< from to)
- (let ((newpos (min to (+ from
rainbow-delimiters-parse-partial-sexp-cache-max-span))))
- (let ((state (parse-partial-sexp from newpos nil nil oldstate)))
- (if (/= newpos to)
- (if cache-nearest-after
- (push (cons newpos state) (cdr cache-nearest-after))
- (push (cons newpos state)
rainbow-delimiters-parse-partial-sexp-cache)))
- (setq oldstate state
- from newpos))))
- oldstate)
+ (if (= from to)
+ (parse-partial-sexp from to nil nil oldstate)
+ (while (< from to)
+ (let ((newpos (min to (+ from
rainbow-delimiters-parse-partial-sexp-cache-max-span))))
+ (let ((state (parse-partial-sexp from newpos nil nil oldstate)))
+ (if (/= newpos to)
+ (if cache-nearest-after
+ (push (cons newpos state) (cdr cache-nearest-after))
+ (push (cons newpos state)
rainbow-delimiters-parse-partial-sexp-cache)))
+ (setq oldstate state
+ from newpos))))
+ oldstate))
(defsubst rainbow-delimiters-syntax-ppss (pos)
"Parse-Partial-Sexp State at POS, defaulting to point.