summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-engine.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
-rw-r--r--lisp/progmodes/cc-engine.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 1f4aa819a53..b8051b274d2 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -2275,7 +2275,9 @@ comment at the start of cc-engine.el for more info."
(while
;; Add an element to `c-state-nonlit-pos-cache' each iteration.
(and
- (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
+ (setq npos
+ (when (<= (+ pos c-state-nonlit-pos-interval) here)
+ (+ pos c-state-nonlit-pos-interval)))
;; Test for being in a literal. If so, go to after it.
(progn
@@ -2302,7 +2304,9 @@ comment at the start of cc-engine.el for more info."
;; Add one extra element above HERE so as to to avoid the previous
;; expensive calculation when the next call is close to the current
;; one. This is especially useful when inside a large macro.
- (setq c-state-nonlit-pos-cache (cons npos c-state-nonlit-pos-cache)))
+ (when npos
+ (setq c-state-nonlit-pos-cache
+ (cons npos c-state-nonlit-pos-cache))))
(if (> pos c-state-nonlit-pos-cache-limit)
(setq c-state-nonlit-pos-cache-limit pos))
@@ -3066,7 +3070,7 @@ comment at the start of cc-engine.el for more info."
(setq dropped-cons (consp (car c-state-cache)))
(setq c-state-cache (cdr c-state-cache))
(setq pos pa))
- ;; At this stage, (> pos here);
+ ;; At this stage, (>= pos here);
;; (< (c-state-cache-top-lparen) here) (or is nil).
(cond